3. Are any queries waiting on something?
On this page
Use the following steps to determine whether your queries are being blocked or waiting for another reason.
-
Check the Active Queries page in Studio, or the
PROCESSLIST.-
On the active queries page in Studio, check whether there are many queued queries by sorting on the
statuscolumn. -
The default
workload_before queries fail is 100.management_ max_ queue_ depth Refer to the List of Engine Variables for more information on this variable. You can also check the current setting by running SHOW VARIABLES
-
If you are using the database client, query MV_
PROCESSLIST. SELECT * FROM information_schema. MV_ PROCESSLIST WHERE state = 'queued';
-
-
Are there queries lingering or in an unkillable state?
-
Check the
PROCESSLISTor the Active Queries page by using the above.-
Sort by
time.If there is a long runtime (depending on a normal run time for your queries, which could be minutes, hours, or days), it is likely the query is hung. -
Identify those queries and run KILL QUERY on them.
This can be done in Studio by checking the boxes shown above, or from the client. -
You can also run KILLALL QUERIES to remove a large number of queries at once.
Note: This will kill all queries, whether hanging or running. -
If you see queries with both a long runtime and a state of
KILLEDon a given node, there may be queries stuck in an unkillable state.Restart the affected node.
-
-
Are queries queued by the workload manager? Check this by querying MV_
WORKLOAD_ MANAGEMENT_ STATUS and looking at Queued Queries (from global queue)&Queued Queries (from local queue)within theStatandValuecolumns.SELECT * FROM information_schema. WORKLOAD_ MANAGEMENT_ STATUS;
-
-
Are queries blocked?
-
Check this by querying information_
schema. MV_ BLOCKED_ QUERIES. SELECT * FROM information_schema. MV_ BLOCKED_ QUERIES; -
Which query is blocked? Check the
QUERY_column.TEXT -
What is blocking it and where is it running? Check the
BLOCKING_andNODE_ ID BLOCKING_columns.QUERY_ TEXT -
Check the blocking reason by looking at the
BLOCKING_TYPE -
Kill the blocking query by using the
IDcolumn, which is the same as theIDininformation_, withschema. PROCESSLIST KILL QUERY <id>.
-
-
If your queries are failing:
-
Is the queue depth too large? Query MV_
PROCESSLIST to check this. SELECT COUNT(*) FROM information_schema. MV_ PROCESSLIST WHERE state = 'queued'; -
Are these queries getting killed by the resource governor? Check resource the status of resource pools by querying RESOURCE_
POOLS. SELECT * FROM information_schema. RESOURCE_ POOLS; -
Examine the failure errors from failed queries.
-
Next Steps
Last modified: November 26, 2024