brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: SHOW FULL PROCESSLIST shows the whole query of every running database thread

Database
~/tips/tip-database-show-full-processlist

mysql -e 'SHOW FULL PROCESSLIST'

Lists every running thread of a MySQL or MariaDB server with its complete SQL text, and lets you stop one.

When a MySQL or MariaDB server suddenly feels slow, this is the first thing I run.

mysql -e 'SHOW FULL PROCESSLIST'
mysql -e 'KILL QUERY 4211'

Without FULL the Info column is cut off after 100 characters, which is rarely enough to recognise a query. Look at the Time column for statements that have been running for minutes, and at State for things like Waiting for table metadata lock.

KILL QUERY id stops the running statement but keeps the connection open, while a plain KILL id drops the connection too. You only see other users’ threads if your account has the PROCESS privilege.

Further reading: MySQL Reference Manual: SHOW PROCESSLIST

More Database tips mariadb -e 'CREATE DATABASE IF NOT EXISTS blog' mariadb-dump --no-create-info --insert-ignore shop orders > orders-rows.sql SELECT table_schema, table_name, CHECKSUM TABLE shop.orders; services: All Database tips (53) All topics

Link