r/PostgreSQL • u/Koushik5586 • Mar 20 '22
How-To Mastering SQL Query Optimization
https://tvkoushik.medium.com/mastering-sql-query-optimization-622cc6addef2?sk=8e8edbfd5cd370461aa25cfb8d667c12
12
Upvotes
r/PostgreSQL • u/Koushik5586 • Mar 20 '22
3
u/swenty Mar 20 '22 edited Mar 20 '22
This seems like a big over-generalization. In some cases calculated fields can interfere with use of indexes. That doesn't mean that you shouldn't ever use calculations in WHERE – just be aware of what effect it's having on use of indexes.
Indeed several of these suggestions seem better as contextually interesting prompts than 'best practice' guidance for how to write queries. Don't just do all of these things blindly. Measure with actual data loads and see what is and isn't affecting performance in your particular situation.