Dear SQL DBA cover image

Why is My Query Faster on the Second Run?

Dear SQL DBA

00:00

Query Rerights - Can I Simplify Optimization?

When you first run query after creating a view, sequal server has to compile a plan. If i am using views, are those views introducing complexity that i don't actually need in my query if i were to write it without the views? Sometimes query rerights aren't an option, depending on your application, right? But whenever you can, it's worth looking at. I would also, as a last resort, look at something like using hints in my query. Some folks do. I think hintser ok but i tend to do them last because a hint is really a directive. In sequel server, you are simplifying optimization using them by taking away choices from the automizer.

Transcript
Play full episode

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app