Query Profilers
Query profilers like pt-query-digest for MySQL or pg_stat_statements for PostgreSQL can help you capture and analyze query performance data. These tools record query execution details, including execution time, query text, and the number of times a query is executed.
# Use pt-query-digest to analyze slow query logs pt-query-digest /var/log/mysql/slow.log