Make the Slow Query Log available in the Performance Schema.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12.4k
- Forks
- 4.4k
- Avg merge
- 8d 16h
- Merged PRs (30d)
- 1
Description
Problem / use case
Today, MySQL can write slow queries to:
- FILE
- mysql.slow_log, when log_output=TABLE
These options work well as log destinations and are useful when users want to retain slow-query history.
However, for quick troubleshooting, they are less convenient:
File logs may require filesystem access.
mysql.slow_log grows until someone truncates or rotates it.
CSV log tables require retention management.
There is no bounded Performance Schema table for recent slow-query events.
This creates friction for DBAs, support engineers, cloud service teams, and monitoring tools that need quick access to recent slow-query activity through SQL.
Proposed behavior
When a query qualifies for the slow query log, MySQL can also store a row in performance_schema.slow_log, if the Performance Schema slow-log consumer is enabled.
Conceptually:
slow query event
-> existing slow-log rules
-> FILE, if log_output includes FILE
-> mysql.slow_log, if log_output includes TABLE
-> performance_schema.slow_log, if the PFS slow-log consumer is enabled}}
The new table should be:
- Optional
- Read-only
- In-memory
- Fixed-size
- Automatically evicting old rows when full
- Independent of log_output=TABLE
- Intended for recent diagnostics, not long-term retention
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing the existing slow-log rules and the Performance Schema consumer configuration, then determine where a bounded in-memory table fits. Done means an optional, read-only, fixed-size performance_schema.slow_log independently captures qualifying events and evicts old rows when full.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, mysql
- Domain
- databases, observability
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100