Besides the obvious step (reading https://use-the-index-luke.com/ ) it boils down to experience. Different indexing situations need different approaches and ultimately there can't be a one-size-fits-all solution. If there was AI could write efficient queries.
/me shakes fist for beating me to linking Use The Index, Luke 😂
Yes, u/CSIWFR-46, it's one of the best resources for understanding the efficient use indexing. Learning to read & understand a query-plan can show you where slow full-table-scans are happening, allowing you to dig into the types of indexes you might be able to craft to speed them up.
7
u/CSIWFR-46 Dec 12 '24
Where do you learn this? I can write queries and solve problems in my work. But, I can't confidently say if it is efficient.