Skip to content

Instantly share code, notes, and snippets.

@threeiem
Last active November 8, 2021 18:59
Show Gist options
  • Save threeiem/8897feef881f02cbd4223a72c8e72321 to your computer and use it in GitHub Desktop.
Save threeiem/8897feef881f02cbd4223a72c8e72321 to your computer and use it in GitHub Desktop.
Get SQL query times from MariaDB

Get slow queries from MariaDB without Sleep

When you are looking at a busy database there is more to see. If you have a lot of Sleep processes they all show up and not the slow query you need. This query helps pull out all the queries that have been running longer than 2 second and aren't Sleep.

SELECT time, state, info FROM information_schema.processlist WHERE command != 'Sleep' AND time >= 2 ORDER BY time DESC, id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment