Secret To Optimizing SQL Queries - Understand The SQL Execution Order

preview_player
Показать описание

Animation tools: Adobe Illustrator and After Effects.

Checkout our bestselling System Design Interview books:

ABOUT US:
Covering topics and trends in large-scale system design, from the authors of the best-selling System Design Interview series.
Рекомендации по теме
Комментарии
Автор

Great video! One addition: The "EXPLAIN" command is an invaluable tool for optimizing SQL queries. It provides a detailed execution plan, allowing the developers to understand how the database engine processes a query. By analyzing the execution plan, you can address the performance bottlenecks with proper optimizations, e.g. proper indexes.

cumbi-mongo
Автор

The way you explained with the animations are Awesome. Great Job. Very Well Explained.

ayazahamed
Автор

bro this way of teaching is really really make sense. thanks a lot for these visuals.

yicpuhf
Автор

Thank you for a fantastic visualization of the SQL queries execution order. That's exactly what I have been missing in the other materials. I really appreciate your style of teaching

lucyk
Автор

One of the best SQL videos I have come across, just the way it is put together and the infographics. If you are learning SQL, you really should understand the mechanics behind optimizing queries, how databases work. Just adding more hardware or VM resources will not fix the issue if your queries are not optimized properly.

JohnS-erjh
Автор

Opt for indexes with SELECT, WHERE, JOIN clauses.
Use full column comparison to get data instead of half or computed comparison (i.e startsWith)
Avoid ORDER_BY on large data retreval
Use limit of smaller number with pagination for more data.

uzair
Автор

This is the best explanation I've ever seen. Big thumbs for you!

siuedvy
Автор

Simple and to the point explanation. Love it. Thanks 👍

AliBensoukehal
Автор

Very profound, please share more on SQL like windows and CTE, your explanation is very approachable.

abhinavx
Автор

What a Video, Voice, Explanation , Graphics and etc...well done mate

bonita
Автор

Thank you for your time and effort to explain any of the subjects. Really like it and more over able to register the concept in mind easily. Thanks again, .

karunakaranr
Автор

Additionally, for the optimizer to "make up" a reasonably good plan (from the various alternatives), it needs to know a bit about the data (value) distribution. This is where STATISTICS / ANALYZE (depends on the DB vendor) come handy. It helps the optimizer do estimates for the various steps (rows, size of data, etc.) of each plan, and figure out which of the different plans is the best candidate to execute. Therefore it is important to collect this information on critical columns (usually join, where clause columns). It is also important to keep this information regularly refreshed so that the optimizer does not make bad decisions based on stale statistics. Very bad things can happen with stale statistics.

iturbcn
Автор

Very good intro. Would like a more detailed explanation on more complex queries.

CyberMew
Автор

Wow. To the point with knowledge I can use today. Thank you.

caseyspaulding
Автор

Excellent video explaining basic concepts in very short time..❤

Impressive graphic animation, could you please share how the execution plan animation was done

avijeethati
Автор

Hi Sir thank you 🙏 for taking the time to explain the SQL. Sorry Iam new and very helpful.

MrSuriyam
Автор

wow, what an awesome introduction to SQL optimization.

JeremyChone
Автор

Understanding how the DB engine works with indexes is key. you may assume that a WHERE purchase_date >= 2022 AND purchase > 100 would be the same if you have indexes on purchase_date and purchase, but it might be required to have a composite index... Order in the WHERE clause may also be important as it helps reducing the dataset before applying the second condition.

stpaquet
Автор

I heard it called "predicate pushdown" when you move a condition earlier in the plan

moneycrab
Автор

Awesome visualization, I've been loving all the short videos on this channel!

Clarifying Q. The execution order has SELECT happening after HAVING, so this should mean that the calculated column total_spent doesn't exist at the time the HAVING clause is evaluated?

yqsison