# Replica SQL Thread States

This article documents thread states that are related to [replication](https://mariadb.com/docs/server/ha-and-performance/standard-replication/replication-overview) slave SQL threads. These correspond to the `Slave_SQL_State` shown by [SHOW SLAVE STATUS](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-replica-status) as well as the `STATE` values listed by the [SHOW PROCESSLIST](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/show/show-processlist) statement and the [Information Schema PROCESSLIST](https://mariadb.com/docs/server/reference/system-tables/information-schema/information-schema-tables/information-schema-processlist-table) as well as the `PROCESSLIST_STATE` value listed in the [Performance Schema threads Table](https://mariadb.com/docs/server/reference/system-tables/performance-schema/performance-schema-tables/performance-schema-threads-table).

| Value                                                                                       | Description                                                                                                                                                                                                                                     |
| ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Apply log event                                                                             | Log event is being applied.                                                                                                                                                                                                                     |
| Making temp file                                                                            | Creating a temporary file containing the row data as part of a [LOAD DATA INFILE](https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/inserting-loading-data/load-data-into-tables-or-index/load-data-infile) statement. |
| Reading event from the relay log                                                            | Reading an event from the [relay log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/relay-log) in order to process the event.                                                                             |
| Slave has read all relay log, waiting for the slave I/O thread to update it                 | All [relay log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/relay-log) events have been processed, now waiting for the I/O thread to write new events to the relay log.                                 |
| Waiting for work from SQL thread                                                            | In parallel replication the worker thread is waiting for more things from the SQL thread.                                                                                                                                                       |
| Waiting for prior transaction to start commit before starting next transaction              | In parallel replication the worker thread is waiting for conflicting things to end before starting executing.                                                                                                                                   |
| Waiting for worker threads to be idle                                                       | Happens in parallel replication when moving to a new binary log after a master restart. All slave temporary files are deleted, and worker threads are restarted.                                                                                |
| Waiting due to global read lock                                                             | In parallel replication when worker threads are waiting for a global read lock to be released.                                                                                                                                                  |
| Waiting for worker threads to pause for global read lock                                    | [FLUSH TABLES WITH READ LOCK](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush) is waiting for worker threads to finish what they are doing.                                         |
| Waiting while replication worker thread pool is busy                                        | Happens in parallel replication during a [FLUSH TABLES WITH READ LOCK](https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush) or when changing number of parallel workers.                |
| Waiting for other master connection to process GTID received on multiple master connections | A worker thread noticed that there is already another thread executing the same GTID from another connection and it's waiting for the other to complete.                                                                                        |
| Waiting for slave mutex on exit                                                             | Thread is stopping. Only occurs very briefly.                                                                                                                                                                                                   |
| Waiting for the next event in relay log                                                     | State before reading next event from the [relay log](https://mariadb.com/docs/server/server-management/server-monitoring-logs/binary-log/relay-log).                                                                                            |

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/server/ha-and-performance/optimization-and-tuning/buffers-caches-and-threads/thread-states/slave-sql-thread-states.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
