The number of wait/synch/mutex/sql/MDL_ticket_store::LOCK_ticket_store_ops in mutex_instances is constantly growing

@anil.joshi

Sorry for the long response.
Yes, the growing number of records in performance_schema.mutex_instances leads to serious problems, as each record in the performance_schema.mutex_instances table also creates a corresponding record in the performance_schema.events_waits_summary_global_by_event_name table. With PMM installed and the recommended settings, PMM makes a high-frequency query to the performance_schema.events_waits_summary_global_by_event_name table, which looks like this:

SELECT
EVENT_NAME,
COUNT_STAR,
SUM_TIMER_WAIT
FROM
performance_schema.events_waits_summary_global_by_event_name

The more records there are in the performance_schema.events_waits_summary_global_by_event_name table, the slower this query runs. Over time, this query itself starts to appear in the slow query log. For now, I’ve found a workaround by adding a setting to mysql.cnf:

performance_schema_max_mutex_instances = 20000