Overview
What Is Parallel Query?
Parallel query (PQ) reduces the processing time of analytical queries to satisfy the low latency requirements of enterprise-grade applications.
It distributes a query task to multiple CPU cores for computation to shorten the query time. Theoretically, the performance improvement of parallel query is positively correlated with the number of CPU cores. The more CPU cores are used, the higher the performance improvement is.
The following figure shows the count(*) process for a table based on parallel query. Table data is divided into blocks and distributed to multiple cores for parallel computing. Each core processes some data to obtain an intermediate count(*) result, and all the intermediate results are aggregated to obtain the final result.
Scenarios
Parallel query is mainly suitable for SELECT statements to query large tables, multiple tables, and a large amount of data. This feature does not benefit extremely short queries.
- Lightweight analysis
The SQL statements for report queries are complex and time-consuming. Parallel query can improve the efficiency of a single query.
- More available system resources
Parallel query requires more system resources. You can enable parallel query to improve resource utilization and query efficiency only when the system has a large number of CPUs, low I/O loads, and sufficient memory resources.
- Frequent data queries
For data-intensive queries, you can use parallel query to improve query processing efficiency, ease network traffic, and reduce pressure on compute nodes.
Supported and Unsupported Scenarios
|
Supported Scenario |
Description |
|---|---|
|
Scans |
Full table scans, index scans, index range scans, index reverse scans, index point queries, and index pushdown |
|
Queries |
Single-table queries, multi-table joins, views, subqueries, and some CTE queries, non-partitioned table queries, single-partition queries of partitioned tables, and UNION/UNION ALL queries |
|
Joins |
BNL JOIN, BKA JOIN, HASH JOIN, NESTED LOOP JOIN, SEMI JOIN, ANTI JOIN, and OUTER JOIN |
|
Subqueries |
Conditional subqueries, scalar subqueries, some correlated subqueries, non-correlated subqueries, and derived tables |
|
Data types |
Integer, character, floating-point, and time |
|
Expression calculation |
Arithmetic expressions (+, -, *, %, /, |, and &) and conditional expressions (<, <=, >, >=, <>, BETWEEN/AND, and IN) |
|
Logical operations |
OR, AND, and NOT |
|
General functions |
Character, integer, and time functions |
|
Aggregate functions |
COUNT, SUM, AVG, MIN, and MAX
CAUTION:
If you want a SQL statement containing the COUNT aggregate function to use TaurusDB parallel query, instead of InnoDB parallel query, set innodb_parallel_select_count to OFF. |
|
Sorting, grouping, pagination, and filtering |
ORDER BY, GROUP BY/DISTINCT, LIMIT/OFFSET, WHERE/HAVING, and column projection |
|
EXPLAIN statements |
EXPLAIN FORMAT=TREE, EXPLAIN ANALYZE (supported in 2.0.60.241200 and later), and EXPLAIN FORMAT=JSON introduced in MySQL 8.0 and traditional EXPLAIN statements |
|
Unsupported Scenario |
Description |
|---|---|
|
Statements |
|
|
Indexes |
|
|
Functions |
|
Incompatibility Between Parallel Queries and Serial Queries
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot


