This topic describes the limits on parallel queries. This topic also describes the inconsistencies between the results of parallel execution and serial execution.

Limits on parallel queries

PolarDB continuously improves the parallel query feature. This feature cannot improve performance in the following situations:

  • Queries on system tables, temporary tables, and InnoDB tables.
  • Queries that use full-text indexes.
  • Stored procedures.
  • Recursive common table expressions (CTEs).
  • Window functions. The parallel query feature cannot be implemented on window functions, but can be implemented on the queries that use window functions.
  • Geographic information system (GIS) functions. The parallel query feature cannot be implemented on GIS functions, but can be implemented on the queries that use window functions.
  • Index merges.
  • Queries in serializable transactions.

Inconsistencies between the results of parallel execution and serial execution

  • The number of error messages may increase.

    Assume that you use serial execution for statements and error messages occur. If you use parallel execution for the same statements, error messages may be returned for each worker thread. This may cause an increase in the total number of error messages.

  • The precision issues may occur.

    For serial execution, no intermediate results need to be stored. For parallel execution, you may need to store intermediate results. If the intermediate results are floating-point numbers, the precision of the floating-point numbers for the intermediate results may be different from that for the final results of parallel execution. This may result in differences in the results of parallel execution and serial execution.

  • The order of the result sets for parallel execution may be different from that for serial execution.

    For parallel execution, multi-thread scans are performed. Therefore, the order of result sets may be different from the execution order of statements. For example, if you include LIMIT clauses and exclude ORDER BY clauses in your statements for parallel execution, the order of the result sets is likely to be different from that for serial execution.

  • The size of network packets or intermediate results exceeds the upper limit that is specified by the max_allowed_packet parameter.

    For serial execution, no intermediate results are produced. For parallel execution, intermediate results may be produced. If the size of the intermediate results exceeds the upper limit that is specified by the max_allowed_packet parameter, an error message may be returned. To resolve this issue, you can increase the value of the max_allowed_packet parameter. For more information about how to modify cluster parameters, see Specify cluster parameters.