This is a read-only copy of the MariaDB Knowledgebase generated on 2024-12-22. For the latest, interactive version please visit https://mariadb.com/kb/.

General Thread States

This article documents the major general thread states. More specific lists related to delayed inserts, replication, the query cache and the event scheduler are listed in:

These correspond to the STATE values listed by the SHOW PROCESSLIST statement or in the Information Schema PROCESSLIST Table as well as the PROCESSLIST_STATE value listed in the Performance Schema threads Table

ValueDescription
After createThe function that created (or tried to create) a table (temporary or non-temporary) has just ended.
AnalyzingCalculating table key distributions, such as when running an ANALYZE TABLE statement.
checking permissionsChecking to see whether the permissions are adequate to perform the statement.
Checking tableChecking the table.
cleaning upPreparing to reset state variables and free memory after executing a command.
closing tablesFlushing the changes to disk and closing the table. This state will only persist if the disk is full or under extremely high load.
converting HEAP to AriaConverting an internal MEMORY temporary table into an on-disk Aria temporary table.
converting HEAP to MyISAMConverting an internal MEMORY temporary table into an on-disk MyISAM temporary table.
copy to tmp tableA new table has been created as part of an ALTER TABLE statement, and rows are about to be copied into it.
Copying to group tableSorting the rows by group and copying to a temporary table, which occurs when a statement has different GROUP BY and ORDER BY criteria.
Copying to tmp tableCopying to a temporary table in memory.
Copying to tmp table on diskCopying to a temporary table on disk, as the resultset is too large to fit into memory.
Creating indexProcessing an ALTER TABLE ... ENABLE KEYS for an Aria or MyISAM table.
Creating sort indexProcessing a SELECT statement resolved using an internal temporary table.
creating tableCreating a table (temporary or non-temporary).
Creating tmp tableCreating a temporary table (in memory or on-disk).
deleting from main tableDeleting from the first table in a multi-table delete, saving columns and offsets for use in deleting from the other tables.
deleting from reference tablesDeleting matched rows from secondary reference tables as part of a multi-table delete.
discard_or_import_tablespaceProcessing an ALTER TABLE ... IMPORT TABLESPACE or ALTER TABLE ... DISCARD TABLESPACE statement.
endState before the final cleanup of an ALTER TABLE, CREATE VIEW, DELETE, INSERT, SELECT, or UPDATE statement.
executingExecuting a statement.
Execution of init_commandExecuting statements specified by the --init_command mariadb client option.
filling schema tableA table in the information_schema database is being built.
freeing itemsFreeing items from the query cache after executing a command. Usually followed by the cleaning up state.
Flushing tablesExecuting a FLUSH TABLES statement and waiting for other threads to close their tables.
FULLTEXT initializationPreparing to run a full-text search. This includes running the fulltext search (MATCH ... AGAINST) and creating a list of the result in memory
initAbout to initialize an ALTER TABLE, DELETE, INSERT, SELECT, or UPDATE statement. Could be performaing query cache cleanup, or flushing the binary log or InnoDB log.
KilledThread will abort next time it checks the kill flag. Requires waiting for any locks to be released.
LockedQuery has been locked by another query.
logging slow queryWriting statement to the slow query log.
NULLState used for SHOW PROCESSLIST.
loginConnection thread has not yet been authenticated.
manage keysEnabling or disabling a table index.
Opening table[s]Trying to open a table. Usually very quick unless the limit set by table_open_cache has been reached, or an ALTER TABLE or LOCK TABLE is in progress.
optimizingServer is performing initial optimizations in for a query.
preparingState occurring during query optimization.
Purging old relay logsRelay logs that are no longer needed are being removed.
query endQuery has finished being processed, but items have not yet been freed (the freeing items state.
Reading fileServer is reading the file (for example during LOAD DATA INFILE).
Reading from netServer is reading a network packet.
Removing duplicatesDuplicated rows being removed before sending to the client. This happens when SELECT DISTINCT is used in a way that the distinct operation could not be optimized at an earlier point.
removing tmp tableRemoving an internal temporary table after processing a SELECT statement.
renameRenaming a table.
rename result tableRenaming a table that results from an ALTER TABLE statement having created a new table.
Reopen tablesTable is being re-opened after thread obtained a lock but the underlying table structure had changed, so the lock was released.
Repair by sortingIndexes are being created with the use of a sort. Much faster than the related Repair with keycache.
Repair doneMulti-threaded repair has been completed.
Repair with keycacheIndexes are being created through the key cache, one-by-one. Much slower than the related Repair by sorting.
Rolling backA transaction is being rolled back.
Saving stateNew table state is being saved. For example, after, analyzing a MyISAM table, the key distributions, rowcount etc. are saved to the .MYI file.
Searching rows for updateFinding matching rows before performing an UPDATE, which is needed when the UPDATE would change the index used for the UPDATE
Sending dataSending data to the client as part of processing a SELECT statement or other statements that returns data like INSERT ... RETURNING . Often the longest-occurring state as it also include all reading from tables and disk read activities. Where an aggregation or un-indexed filtering occurs there is significantly more rows read than what is sent to the client.
setupSetting up an ALTER TABLE operation.
Sorting for groupSorting as part of a GROUP BY
Sorting for orderSorting as part of an ORDER BY
Sorting indexSorting index pages as part of a table optimization operation.
Sorting resultProcessing a SELECT statement using a non-temporary table.
statisticsCalculating statistics as part of deciding on a query execution plan. Usually a brief state unless the server is disk-bound.
System lockRequesting or waiting for an external lock for a specific table. The storage engine determines what kind of external lock to use. For example, the MyISAM storage engine uses file-based locks. However, MyISAM's external locks are disabled by default, due to the default value of the skip_external_locking system variable. Transactional storage engines such as InnoDB also register the transaction or statement with MariaDB's transaction coordinator while in this thread state. See MDEV-19391 for more information about that.
Table lockAbout to request a table's internal lock after acquiring the table's external lock. This thread state occurs after the System lock thread state.
updateAbout to start updating table.
UpdatingSearching for and updating rows in a table.
updating main tableUpdating the first table in a multi-table update, and saving columns and offsets for use in the other tables.
updating reference tablesUpdating the secondary (reference) tables in a multi-table update
updating statusThis state occurs after a query's execution is complete. If the query's execution time exceeds long_query_time, then Slow_queries is incremented, and if the slow query log is enabled, then the query is logged. If the SERVER_AUDIT plugin is enabled, then the query is also logged into the audit log at this stage. If the userstats plugin is enabled, then CPU statistics are also updated at this stage.
User lockAbout to request or waiting for an advisory lock from a GET LOCK() call. For SHOW PROFILE, means requesting a lock only.
User sleepA SLEEP() call has been invoked.
Waiting for commit lockFLUSH TABLES WITH READ LOCK is waiting for a commit lock, or a statement resulting in an explicit or implicit commit is waiting for a read lock to be released. This state was called Waiting for all running commits to finish in earlier versions.
Waiting for global read lockWaiting for a global read lock.
Waiting for table level lockExternal lock acquired,and internal lock about to be requested. Occurs after the System lock state. In earlier versions, this was called Table lock.
Waiting for xx lockWaiting to obtain a lock of type xx.
Waiting on condWaiting for an unspecified condition to occur.
Writing to netWriting a packet to the network.
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.