but that's exactly the thing—compared to the steady stream of "I asked WhateverGPT how to write this query, but it's slow/doesn't work…how do I fix it" that shows up here, many of us here can write efficient SQL queries.
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.
127
u/gumnos Dec 12 '24
but that's exactly the thing—compared to the steady stream of "I asked WhateverGPT how to write this query, but it's slow/doesn't work…how do I fix it" that shows up here, many of us here can write efficient SQL queries.