Skip to content
Preptima
mediumConceptMidSeniorStaff

Before you tune anything, how do you decide which queries are worth your time?

4 min readUpdated 2026-08-15Target archetype: Big Tech, Enterprise Captive, Product Startup

Answer

Short answer

Rank by the total time a statement shape consumes across a measured window rather than by the slowest single execution, then check what that time was spent waiting on before touching the SQL.

Was this answer helpful?

Likely follow-ups

  • Two statements have the same mean duration but very different maxima. What are you looking at, and what do you do next?
  • The top statement by total time turns out to be a health check running every second. How do you treat that?
  • How would you capture plans for the slow executions only, without logging every statement?
  • The database looks idle and the application is still slow. Where does that leave this method?

Related questions

Further reading