3 ms·
It describes all the way the SQL could be executed, then choses the faster plan. For example: if you're looking for the user row with user_id xx, do you read th
by BenoitP 2y ago
It describes all the way the SQL could be executed, then choses the faster plan. For example: if you're looking for the user row with user_id xx, do you read the full table then filter it (you have to look at all the rows)? Or do you use the dedicated data structure to do so (an index will enable to do it in the logarithm of the number of rows)?
A lot more can be done: choosing the join order, choosing the join strategies, pushing the filter predicates at the source, etc. That's the vast topic of SQL optimization.
- abhishekjha 2y agoIs there a more general reading for software engineers? Seems like jumping right into the code can be a bit overwhelming if you have no background on the topic.
- orlp 2y agoNot exactly reading but I would recommend the database engineering courses by Andy Pavlo that are freely available on YouTube.
- jmgimeno 2y agoPostgreSQL Query Optimization: The Ultimate Guide to Building Efficient Queries, by Henrietta Dombrovskaya and Boris Novikov Anna Bailliekova, published by Apress in 2021.
- rotifer 2y agoYou may discover this if you go to the Apress site, but there is a second edition [1] out. [1] https://hdombrovskaya.wordpress.com/2024/01/11/the-optimization-book-second-edition-is-here/ https://hdombrovskaya.wordpress.com/2024/01/11/the-optimizat...
- sbuttgereit 2y agoAlways worth a mention: https://use-the-index-luke.com/ https://use-the-index-luke.com/ Markus Winand (the website's author) has also written a book on the subject targeted at software developers which is decent for non-DBA level knowledge.
- whiterknight 2y agohttps://www.sqlite.org/queryplanner.html https://www.sqlite.org/queryplanner.html