Get history of queries on MariaDB I'm trying to get a table of recent slow queries on a MariaDB/MySQL server.

MariaDB [(none)]&gt; SELECT TRUNCATE(TIMER_WAIT/1000000000000,6) as Duration,SQL_TEXT FROM performance_schema.events_statements_current;
+----------+--------------------------------------------------------------------------------------------------------------------+
| Duration | SQL_TEXT                                                                                                           |
+----------+--------------------------------------------------------------------------------------------------------------------+
| 0.000221 | SELECT TRUNCATE(TIMER_WAIT/1000000000000,6) as Duration,SQL_TEXT FROM performance_schema.events_statements_current |
+----------+--------------------------------------------------------------------------------------------------------------------+


performance_schema.events_statements_current will only give me the most recent query, so my own. When I try to use performance_schema.events_statements_history_long I don't get much.

Empty set (0.00 sec)


Why does current works and not history_long?
My performance_schema.setup_consumers was not properly set.

By default performance_schema.events_statements_history_long is not enabled.

update setup_consumers set enabled="YES" where name="events_statements_history";
update setup_consumers set enabled="YES" where name="events_statements_history_long";