3min chapter

Dear SQL DBA cover image

Why is My Query Faster on the Second Run?

Dear SQL DBA

CHAPTER

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.

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode