3 ms·
You can use the slow query log which is very helpful. Lots of logging tools will injest it properly and you can aggregate queries that are ran frequently. Havin
by thinkingkong 4y ago
You can use the slow query log which is very helpful. Lots of logging tools will injest it properly and you can aggregate queries that are ran frequently. Having an index or not is just one optimization.
- ahachete 4y agoMany of those queries may run sub-second (typical lower-end value for log_min_duration_statement), so they won't get logged. Yet, if called at high frequency, may represent a notable % of your CPU and I/O. The slow query log is not enough in many cases.
- sroussey 4y agoThe MySQL slow query log can be made to log queries that don't use an index, even if fast. Maybe some tweaks to this idea for postgresql.
- ahachete 4y agoMaybe... but there are many queries that don't use an index (whether fast or slow) and that's the right thing to do. As a DBA, I'd see too many "false positives" due to this reason.