Apologies for the super late reply, I was travelling.
I totally agree, and that’s where experience comes into play and building a more holistic understanding of how the systems you’re using actually work. If I had a slow query in, say, Postgres, the very first thing I would be doing is “explain analyze” to see what the query plan is and what steps the database will be doing to execute it. 98% of the time doing that will either give you insight into how you might restructure your query or which indices you need to add to make it faster.
I totally agree, and that’s where experience comes into play and building a more holistic understanding of how the systems you’re using actually work. If I had a slow query in, say, Postgres, the very first thing I would be doing is “explain analyze” to see what the query plan is and what steps the database will be doing to execute it. 98% of the time doing that will either give you insight into how you might restructure your query or which indices you need to add to make it faster.