Considerations when Using GPORCA

Considerations when Using GPORCA

To execute queries optimally with GPORCA, query criteria to consider.
Ensure the following criteria are met:
  • The table does not contain multi-column partition keys.
  • The multi-level partitioned table is a uniform multi-level partitioned table. See About Uniform Multi-level Partitioned Tables.
  • The server configuration parameter optimizer_enable_master_only_queries is set to on when running against master only tables such as the system table pg_attribute. For information about the parameter, see the Greenplum Database Reference Guide.
    Note: Enabling this parameter decreases performance of short running catalog queries. To avoid this issue, set this parameter only for a session or a query.
  • Statistics have been collected on the root partition of a partitioned table.

If the partitioned table contains more than 20,000 partitions, consider a redesign of the table schema.

These server configuration parameters affect GPORCA query processing.

  • The parameter optimizer_join_order_threshold specifies the maximum number of join children for which GPORCA uses the dynamic programming-based join ordering algorithm.
  • The parameter optimizer_parallel_union controls the amount of parallelization that occurs for queries that contain a UNION or UNION ALL clause. When the value is on, Pivotal Query Optimizer can generate a query plan the child operations of a UNION or UNION ALL operation execute in parallel on segment instances.
  • The parameter optimizer_sort_factor controls the cost factor that Pivotal Query Optimizer applies to sorting operations during query optimization. The cost factor can be adjusted for queries when data skew is present.

For information about the parameter, see the Greenplum Database Reference Guide.

GPORCA generates minidumps to describe the optimization context for a given query. The minidump files are used by Pivotal support to analyze Greenplum Database issues. The information in the file is not in a format that can be easily used by customers for debugging or troubleshooting. The minidump file is located under the master data directory and uses the following naming format:


For information about the minidump file, see the server configuration parameter optimizer_minidump in the Greenplum Database Reference Guide.

When the EXPLAIN ANALYZE command uses GPORCA, the EXPLAIN plan shows only the number of partitions that are being eliminated. The scanned partitions are not shown. To show name of the scanned partitions in the segment logs set the server configuration parameter gp_log_dynamic_partition_pruning to on. This example SET command enables the parameter.

SET gp_log_dynamic_partition_pruning = on;