r/SQL • u/OnepieceKing2222 • Sep 16 '26
Discussion What SQL query optimization trick made the biggest difference for you?
I've been working with SQL for a while and recently started paying more attention to query performance rather than just getting the correct result.
What's one SQL optimization technique that made a noticeable difference for you?
For example:
- Indexing
- Avoiding unnecessary joins
- Window functions
- EXISTS vs IN
- Reading execution plans
- CTEs/subqueries
- Partitioning
Would be interested in hearing some real-world examples where a query went from slow to significantly faster.
119
Upvotes
View all comments
Show parent comment
2
u/TheGoblinPopper Sep 16 '26
I started with that as a foundation... But the AI needs a LOT of handholding to understand the tables and such. If you aren't crazy about documentation, give the AI your metadata files, then ask it to review and perform a Q&A with you to build out the documentation.
Anyone who disagrees and thinks 'AI is good enough' doesn't work with 1200 tables enterprise systems.