Slow Queries
DebugHawk identifies database queries that take longer than your configured threshold and flags them as slow queries.
How Slow Queries Are Detected
DebugHawk monitors every database query during page generation. When a query exceeds your slow_queries_threshold
setting (50ms by default), it's captured and sent to DebugHawk along with detailed execution information.
The system captures up to your configured slow_queries_limit
(3 by default) per request, focusing on the slowest queries.
Understanding the Data
Each slow query record includes:
- Query: The actual SQL statement that was executed
- Duration: How long the query took to complete (in milliseconds)
- Component: The WordPress component (core, plugin, theme) that generated the query
- Location: The PHP file and line number where the query originated
- When: Timestamp of when the query was executed
Configuration
Slow query detection is controlled by two settings in your wp-config.php
:
define( 'DEBUGHAWK_CONFIG', [
'slow_queries_threshold' => 50, // Flag queries over 50ms
'slow_queries_limit' => 3, // Capture up to 3 per request
] );
Threshold Recommendations
- 50ms (default): Suitable for most WordPress sites
- 25ms: More aggressive threshold for high-performance sites
- 100ms: Relaxed threshold for sites with expected database load
Limit Considerations
The default limit of 3 slow queries per request balances monitoring completeness with data volume.