Aurora PostgreSQL query plan management updates - Amazon Aurora
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Aurora PostgreSQL query plan management updates

The Amazon apg_plan_mgmt extension provides your Aurora PostgreSQL DB cluster with the query plan management feature. It allows you to manage the query execution plans generated by the optimizer for your SQL applications for better stability and to prevent regressions. For more information, see Managing query execution plans for Aurora PostgreSQL in the Amazon Aurora User Guide.

PostgreSQL 16 versions

apg_plan_mgmt version 2.7 for Aurora PostgreSQL 16.3

Improvements to the apg_plan_mgmt extension in version 2.7 for Aurora PostgreSQL 16.3 include the following:

New features
  • You no longer need to update the plan_hash_version. After upgrading the database engine, QPM automatically enables new features. You don't need to take any action for new features to become available.

Additional improvements and enhancements
  • Fixed an issue with enforcement of QPM plans containing more than 64 partitioned tables.

  • Fixed an issue with enforcement of QPM plans containing the Append operator.

  • Fixed an issue with QPM validate_plans with update_plan_hash action.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 16.2

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 16.2 include the following:

New features
  • QPM can enforce plans having Aggregate operators.

Additional improvements and enhancements
  • Fixed an issue where dropping a database did not remove associated captured plans from shared memory.

  • Fixed an issue with enforcement of plans containing views.

  • Improvements in Parallel Append plan enforcement.

  • Fixed an issue related to plan capture.

  • Fixed an issue with enforcement of plans containing gather nodes.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 16.1

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 16.1 include the following:

New features
  • Plan outlines will be updated to the latest format version as part of the update_plan_hash action for apg_plan_mgmt.validate_plans function.

  • Added support for parallel Append enforcement as a part of Parallel Query Enforcement. To enforce parallel append nodes correctly, you must do the following:

    1. Set apg_plan_mgmt.plan_hash_version to 5.

    2. Call apg_plan_mgmt.validate_plans('update_plan_hash').

Additional improvements and enhancements
  • Performance improvement in plan hash calculation.

  • Enhanced memory utilization for plan outlines that contain repetitive subplans.

  • Fixed an issue in parallel query enforcement where GatherMerge could not be enforced.

  • Fixed an issue where estimated cost of enforced plan was incorrect.

  • Fixed an issue in enforcement of approved plans where the outline contains partitioned tables and subplans.

PostgreSQL 15 versions

apg_plan_mgmt version 2.7 for Aurora PostgreSQL 15.8, September 30, 2024

Improvements to the apg_plan_mgmt extension in version 2.7 for Aurora PostgreSQL 15.8 include the following:

Additional improvements and enhancements
  • Fixed an issue with enforcement of Query Plan Management plans containing Hash Aggregates.

apg_plan_mgmt version 2.7 for Aurora PostgreSQL 15.7, August 8, 2024

Improvements to the apg_plan_mgmt extension in version 2.7 for Aurora PostgreSQL 15.7 include the following:

New features
  • You no longer need to update the plan_hash_version. After upgrading the database engine, QPM automatically enables new features. You don't need to take any action for new features to become available.

Additional improvements and enhancements
  • Fixed an issue with enforcement of QPM plans containing more than 64 partitioned tables.

  • Fixed an issue with enforcement of QPM plans containing the Append operator.

  • Fixed an issue with QPM validate_plans with update_plan_hash action.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 15.6

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 15.6 include the following:

New features
  • QPM can enforce plans having Aggregate operators.

Additional improvements and enhancements
  • Fixed an issue where dropping a database did not remove associated captured plans from shared memory.

  • Fixed an issue with enforcement of plans containing views.

  • Improvements in Parallel Append plan enforcement.

  • Fixed an issue related to plan capture.

  • Fixed an issue with enforcement of plans containing gather nodes.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 15.5

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 15.5 include the following:

New features
  • Plan outlines will be updated to the latest format version as part of the update_plan_hash action for apg_plan_mgmt.validate_plans function.

  • Added support for parallel Append enforcement as a part of Parallel Query Enforcement. To enforce parallel append nodes correctly, you must do the following:

    1. Set apg_plan_mgmt.plan_hash_version to 5.

    2. Call apg_plan_mgmt.validate_plans('update_plan_hash').

Additional improvements and enhancements
  • Performance improvement in plan hash calculation.

  • Enhanced memory utilization for plan outlines that contain repetitive subplans.

  • Fixed an issue in parallel query enforcement where GatherMerge could not be enforced.

  • Fixed an issue where estimated cost of enforced plan was incorrect.

  • Fixed an issue in enforcement of approved plans where the outline contains partitioned tables and subplans.

apg_plan_mgmt version 2.5 for Aurora PostgreSQL 15.4

Improvements to the apg_plan_mgmt extension in version 2.5 for Aurora PostgreSQL 15.4 include the following:

New features
  • QPM can enforce query plans to have parallel operators except Parallel Append node. To enforce parallel query plans correctly, you must do the following after upgrading to 15.4 or 14.9:

    • Set apg_plan_mgmt.plan_hash_version to 4 or above.

    • Call apg_plan_mgmt.validate_plans('update_plan_hash').

    • Re-capture approved plans that has Gather node in plan_outline.

  • QPM can enforce query plans with Materialize nodes. To enforce Materialize nodes, you must do the following after upgrading to 15.4 or 14.9:

    • Set apg_plan_mgmt.plan_hash_version to 4 or above.

    • Call apg_plan_mgmt.validate_plans('update_plan_hash').

  • To capture query plans from Replicas, you must update apg_plan_mgmt extension by calling ALTER EXTENSION apg_plan_mgmt UPDATE.

  • You need to specify apg_plan_mgmt.plan_capture_threshold in order to not allow QPM to capture any query plans.

Additional improvements and enhancements
  • Performance improvement on plan_hash calculation.

apg_plan_mgmt version 2.4 for Aurora PostgreSQL 15.3

Improvements to the apg_plan_mgmt extension in version 2.4 for Aurora PostgreSQL 15.3 include the following:

New features
  • Introduced a new GUC auto_explain.hashes. When it is set to true (default: false), sql_hash and plan_hash are shown at the end of auto explain result.

  • Introduced a new GUC apg_plan_mgmt.explain_hashes. When it is set to true (default: false), EXPLAIN result shows sql_hash and plan_hash even without hashes true option.

  • Introduced a new GUC apg_plan_mgmt.log_plan_enforcement_result. Depending on its value (default: none), plan enforcement results are written to Postgres log files.

  • Introduced a new plan hash calculation version to support partitioned tables. Users need to set apg_plan_mgmt.plan_hash_version to 3 and call apg_plan_mgmt.validate_plans('update_plan_hash') in each database with apg_plan_mgmt installed and entries in the plans table.

  • QPM can enforce query plans with Memoize nodes.

  • The apg_plan_mgmt.copy_outline function can take a new 5th argument, force_update_target_plan_hash. If it is set to true, the target plan hash will be updated even though the source plan isn't reproducible for the target sql_hash.

Additional improvements and enhancements
  • Fixed an issue with JDBC prepared statements plan enforcement.

  • Improved parity regarding queryid between pg_stat_statements and apg_plan_mgmt.dba_plans.

  • Fixed a plan enforcement issue when index names end with digits.

  • The apg_plan_mgmt.copy_outline function now copies environment_variables.

  • The minimum value of apg_plan_mgmt.plan_retention_period changes to 1 from 32.

  • The query plan management can now save plans for queries in read-only transactions from the writer nodes.

  • Fixed an issue in the apg_plan_mgmt.evolve_plan_baselines function.

  • Fixed an issue that could cause unavailability when the apg_plan_mgmt is enabled.

To learn how to install, upgrade, and use the apg_plan_mgmt extension, see Managing query execution plans for Aurora PostgreSQL in the Amazon Aurora User Guide.

PostgreSQL 14 versions

apg_plan_mgmt version 2.7 for Aurora PostgreSQL 14.12, August 8, 2024

Improvements to the apg_plan_mgmt extension in version 2.7 for Aurora PostgreSQL 14.12 include the following:

New features
  • You no longer need to update the plan_hash_version. After upgrading the database engine, QPM automatically enables new features. You don't need to take any action for new features to become available.

Additional improvements and enhancements
  • Fixed an issue with enforcement of QPM plans containing more than 64 partitioned tables.

  • Fixed an issue with enforcement of QPM plans containing the Append operator.

  • Fixed an issue with QPM validate_plans with update_plan_hash action.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 14.11

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 14.11 include the following:

New features
  • QPM can enforce plans having Aggregate operators.

Additional improvements and enhancements
  • Fixed an issue where dropping a database did not remove associated captured plans from shared memory.

  • Fixed an issue with enforcement of plans containing views.

  • Improvements in Parallel Append plan enforcement.

  • Fixed an issue related to plan capture.

  • Fixed an issue with enforcement of plans containing gather nodes.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 14.10

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 14.10 include the following:

New features
  • Plan outlines will be updated to the latest format version as part of the update_plan_hash action for apg_plan_mgmt.validate_plans function.

  • Added support for parallel Append enforcement as a part of Parallel Query Enforcement. To enforce parallel append nodes correctly, you must do the following:

    1. Set apg_plan_mgmt.plan_hash_version to 5.

    2. Call apg_plan_mgmt.validate_plans('update_plan_hash').

Additional improvements and enhancements
  • Performance improvement in plan hash calculation.

  • Enhanced memory utilization for plan outlines that contain repetitive subplans.

  • Fixed an issue in parallel query enforcement where GatherMerge could not be enforced.

  • Fixed an issue where estimated cost of enforced plan was incorrect.

  • Fixed an issue in enforcement of approved plans where the outline contains partitioned tables and subplans.

apg_plan_mgmt version 2.5 for Aurora PostgreSQL 14.9

Improvements to the apg_plan_mgmt extension in version 2.5 for Aurora PostgreSQL 14.9 include the following:

New features
  • QPM can enforce query plans to have parallel operators except Parallel Append node. To enforce parallel query plans correctly, you must do the following after upgrading to 15.4 or 14.9:

    • Set apg_plan_mgmt.plan_hash_version to 4 or above.

    • Call apg_plan_mgmt.validate_plans('update_plan_hash').

    • Re-capture approved plans that has Gather node in plan_outline.

  • QPM can enforce query plans with Materialize nodes. To enforce Materialize nodes, you must do the following after upgrading to 15.4 or 14.9:

    • Set apg_plan_mgmt.plan_hash_version to 4 or above.

    • Call apg_plan_mgmt.validate_plans('update_plan_hash').

  • To capture query plans from Replicas, you must update apg_plan_mgmt extension by calling ALTER EXTENSION apg_plan_mgmt UPDATE.

  • You need to specify apg_plan_mgmt.plan_capture_threshold in order to not allow QPM to capture any query plans.

Additional improvements and enhancements
  • Performance improvement on plan_hash calculation.

apg_plan_mgmt version 2.4 for Aurora PostgreSQL 14.8

Improvements to the apg_plan_mgmt extension in version 2.4 for Aurora PostgreSQL 14.8 include the following:

New features
  • Introduced a new GUC auto_explain.hashes. When it is set to true (default: false), sql_hash and plan_hash are shown at the end of auto explain result.

  • Introduced a new GUC apg_plan_mgmt.explain_hashes. When it is set to true (default: false), EXPLAIN result shows sql_hash and plan_hash even without hashes true option.

  • Introduced a new GUC apg_plan_mgmt.log_plan_enforcement_result. Depending on its value (default: none), plan enforcement results are written to Postgres log files.

  • Introduced a new plan hash calculation version to support partitioned tables. Users need to set apg_plan_mgmt.plan_hash_version to 3 and call apg_plan_mgmt.validate_plans('update_plan_hash') in each database with apg_plan_mgmt installed and entries in the plans table.

  • QPM can enforce query plans with Memoize nodes.

  • The apg_plan_mgmt.copy_outline function can take a new 5th argument, force_update_target_plan_hash. If it is set to true, the target plan hash will be updated even though the source plan isn't reproducible for the target sql_hash.

Additional improvements and enhancements
  • Fixed an issue with JDBC prepared statements plan enforcement.

  • Improved parity regarding queryid between pg_stat_statements and apg_plan_mgmt.dba_plans.

  • Fixed a plan enforcement issue when index names end with digits.

  • The apg_plan_mgmt.copy_outline function now copies environment_variables.

  • The minimum value of apg_plan_mgmt.plan_retention_period changes to 1 from 32.

  • The query plan management can now save plans for queries in read-only transactions from the writer nodes.

  • Fixed an issue in the apg_plan_mgmt.evolve_plan_baselines function.

  • Fixed an issue that could cause unavailability when the apg_plan_mgmt is enabled.

To learn how to install, upgrade, and use the apg_plan_mgmt extension, see Managing query execution plans for Aurora PostgreSQL in the Amazon Aurora User Guide.

PostgreSQL 13 versions

apg_plan_mgmt version 2.7 for Aurora PostgreSQL 13.15, August 8, 2024

Improvements to the apg_plan_mgmt extension in version 2.7 for Aurora PostgreSQL 13.15 include the following:

New features
  • You no longer need to update the plan_hash_version. After upgrading the database engine, QPM automatically enables new features. You don't need to take any action for new features to become available.

Additional improvements and enhancements
  • Fixed an issue with enforcement of QPM plans containing more than 64 partitioned tables.

  • Fixed an issue with enforcement of QPM plans containing the Append operator.

  • Fixed an issue with QPM validate_plans with update_plan_hash action.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 13.14

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 13.14 include the following:

New features
  • QPM can enforce plans having Aggregate operators.

Additional improvements and enhancements
  • Fixed an issue where dropping a database did not remove associated captured plans from shared memory.

  • Fixed an issue with enforcement of plans containing views.

  • Improvements in Parallel Append plan enforcement.

  • Fixed an issue related to plan capture.

  • Fixed an issue with enforcement of plans containing gather nodes.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 13.13

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 13.13 include the following:

New features
  • Plan outlines will be updated to the latest format version as part of the update_plan_hash action for apg_plan_mgmt.validate_plans function.

  • Added support for parallel Append enforcement as a part of Parallel Query Enforcement. To enforce parallel append nodes correctly, you must do the following:

    1. Set apg_plan_mgmt.plan_hash_version to 5.

    2. Call apg_plan_mgmt.validate_plans('update_plan_hash').

Additional improvements and enhancements
  • Performance improvement in plan hash calculation.

  • Enhanced memory utilization for plan outlines that contain repetitive subplans.

  • Fixed an issue in parallel query enforcement where GatherMerge could not be enforced.

  • Fixed an issue where estimated cost of enforced plan was incorrect.

  • Fixed an issue in enforcement of approved plans where the outline contains partitioned tables and subplans.

apg_plan_mgmt version 2.5 for Aurora PostgreSQL 13.12

Improvements to the apg_plan_mgmt extension in version 2.5 for Aurora PostgreSQL 13.12 include the following:

New features
  • QPM can enforce query plans to have parallel operators except Parallel Append node. To enforce parallel query plans correctly, you must do the following after upgrading to 15.4 or 14.9:

    • Set apg_plan_mgmt.plan_hash_version to 4 or above.

    • Call apg_plan_mgmt.validate_plans('update_plan_hash').

    • Re-capture approved plans that has Gather node in plan_outline.

  • To capture query plans from Replicas, you must update apg_plan_mgmt extension by calling ALTER EXTENSION apg_plan_mgmt UPDATE.

  • You need to specify apg_plan_mgmt.plan_capture_threshold in order to not allow QPM to capture any query plans.

apg_plan_mgmt version 2.4 for Aurora PostgreSQL 13.11

Improvements to the apg_plan_mgmt extension in version 2.4 for Aurora PostgreSQL 13.11 include the following:

New features
  • Introduced a new GUC auto_explain.hashes. When it is set to true (default: false), sql_hash and plan_hash are shown at the end of auto explain result.

  • Introduced a new GUC apg_plan_mgmt.explain_hashes. When it is set to true (default: false), EXPLAIN result shows sql_hash and plan_hash even without hashes true option.

  • Introduced a new GUC apg_plan_mgmt.log_plan_enforcement_result. Depending on its value (default: none), plan enforcement results are written to Postgres log files.

  • Introduced a new plan hash calculation version to support partitioned tables. Users need to set apg_plan_mgmt.plan_hash_version to 3 and call apg_plan_mgmt.validate_plans('update_plan_hash') in each database with apg_plan_mgmt installed and entries in the plans table.

  • The apg_plan_mgmt.copy_outline function can take a new 5th argument, force_update_target_plan_hash. If it is set to true, the target plan hash will be updated even though the source plan isn't reproducible for the target sql_hash.

Additional improvements and enhancements
  • Fixed an issue with JDBC prepared statements plan enforcement.

  • Fixed a plan enforcement issue when index names end with digits.

  • The apg_plan_mgmt.copy_outline function now copies environment_variables.

  • The minimum value of apg_plan_mgmt.plan_retention_period changes to 1 from 32.

  • The query plan management can now save plans for queries in read-only transactions from the writer nodes.

  • Fixed an issue in the apg_plan_mgmt.evolve_plan_baselines function.

  • Fixed an issue that could cause unavailability when the apg_plan_mgmt is enabled.

To learn how to install, upgrade, and use the apg_plan_mgmt extension, see Managing query execution plans for Aurora PostgreSQL in the Amazon Aurora User Guide.

PostgreSQL 12 versions

apg_plan_mgmt version 2.7 for Aurora PostgreSQL 12.19, August 8, 2024

Improvements to the apg_plan_mgmt extension in version 2.7 for Aurora PostgreSQL 12.19 include the following:

New features
  • You no longer need to update the plan_hash_version. After upgrading the database engine, QPM automatically enables new features. You don't need to take any action for new features to become available.

Additional improvements and enhancements
  • Fixed an issue with enforcement of QPM plans containing more than 64 partitioned tables.

  • Fixed an issue with enforcement of QPM plans containing the Append operator.

  • Fixed an issue with QPM validate_plans with update_plan_hash action.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 12.18

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 12.18 include the following:

Additional improvements and enhancements
  • Fixed an issue related to plan capture.

apg_plan_mgmt version 2.6 for Aurora PostgreSQL 12.17

Improvements to the apg_plan_mgmt extension in version 2.6 for Aurora PostgreSQL 12.17 include the following:

New features
  • Plan outlines will be updated to the latest format version as part of the update_plan_hash action for apg_plan_mgmt.validate_plans function.

apg_plan_mgmt version 2.5 for Aurora PostgreSQL 12.16

Improvements to the apg_plan_mgmt extension in version 2.5 for Aurora PostgreSQL 12.16 include the following:

New features
  • To capture query plans from Replicas, you must update apg_plan_mgmt extension by calling ALTER EXTENSION apg_plan_mgmt UPDATE.

  • You need to specify apg_plan_mgmt.plan_capture_threshold in order to not allow QPM to capture any query plans.

Version 2.3 of the Aurora PostgreSQL apg_plan_mgmt extension

Improvements to the apg_plan_mgmt extension in version 2.3 includes the following:

New extension features
  • Support for a new function, the apg_plan_mgmt.copy_outline function. This function allows you to copy a plan hash and a plan outline from one SQL hash and plan hash to another. Use this function when you want to copy a plan that uses hints to other similar statements without using the in-line hint statement at every occurrence. If the update to the query results in an invalid plan, the function raises an error and rolls back the update. For more information, see Function reference for Aurora PostgreSQL query plan management in the Amazon Aurora User Guide.

Extension improvements
  • The query plan management feature now saves plans for queries that are inside procedures and DO-blocks. For versions of apg_plan_mgmt older than version 2.3, this has been a limitation.

To learn how to install, upgrade, and use the apg_plan_mgmt extension, see Managing query execution plans for Aurora PostgreSQL in the Amazon Aurora User Guide.

Version 2.1 of the Aurora PostgreSQL apg_plan_mgmt extension

Improvements to the apg_plan_mgmt extension in version 2.1 for Aurora PostgreSQL 11.20 includes the following:

New extension features in Aurora PostgreSQL 11.20
  • Introduced a new GUC apg_plan_mgmt.log_plan_enforcement_result. Depending on its value (default: none), plan enforcement results are written to Postgres log files.

Extension improvements in Aurora PostgreSQL 11.20
  • Fixed an issue with JDBC prepared statements plan enforcement.

To learn how to install, upgrade, and use the apg_plan_mgmt extension, see Managing query execution plans for Aurora PostgreSQL in the Amazon Aurora User Guide.

Version 2.0 of the Aurora PostgreSQL apg_plan_mgmt extension

The apg_plan_mgmt extension changes for version 2.0 include the following:

New extension features
  1. You can now manage all queries inside SQL functions, whether they have parameters or not.

  2. You can now manage all queries inside PL/pgSQL functions, whether they have parameters or not.

  3. You can now manage queries in generic plans, whether they have parameters or not. To learn more about generic plans versus custom plans, see the PREPARE statement in the PostgreSQL documentation.

  4. You can now use query plan management to enforce the use of specific types of aggregate methods in query plans.

Extension improvements
  1. You can now save plans with a size up to 8KB times the setting of the max_worker_processes parameter. Previously the maximum plan size was 8KB.

  2. Fixed bugs for unnamed prepared statements such as those from JDBC.

  3. Previously, when you tried to do CREATE EXTENSION apg_plan_mgmt when it is not loaded in the shared_preload_libraries, the PostgreSQL backend connection was dropped. Now, an error message prints and the connection is not dropped.

  4. The default value of the cardinality_error in the apg_plan_mgmt.plans table is NULL, but it can be set to -1 during the apg_plan_mgmt.evolve_plan_baselines function. NULL is now used consistently.

  5. Plans are now saved for queries that refer to temporary tables.

  6. The default maximum number of plans is increased from 1000 to 10000.

  7. The following pgss parameters are deprecated because the automatic plan capture mode should be used instead of those parameters.

    • apg_plan_mgmt.pgss_min_calls

    • apg_plan_mgmt.pgss_min_mean_time_ms

    • apg_plan_mgmt.pgss_min_stddev_time_ms

    • apg_plan_mgmt.pgss_min_total_time_ms

Version 1.0.1 of the Aurora PostgreSQL apg_plan_mgmt extension

The apg_plan_mgmt extension changes for version 1.0.1 include the following:

New extension features
  1. The validate_plans function has a new action value called update_plan_hash. This action updates the plan_hash ID for plans that can't be reproduced exactly. The update_plan_hash value also allows you to fix a plan by rewriting the SQL. You can then register the good plan as an Approved plan for the original SQL. Following is an example of using the update_plan_hash action.

    UPDATE apg_plan_mgmt.plans SET plan_hash = new _plan_hash, plan_outline = good_plan_outline WHERE sql_hash = bad_plan_sql_hash AND plan_hash = bad_plan_plan_hash; SELECT apg_plan_mgmt.validate_plans(bad_plan_sql_hash, bad_plan_plan_hash, 'update_plan_hash'); SELECT apg_plan_mgmt.reload();
  2. A new get_explain_stmt function is available that generates the text of an EXPLAIN statement for the specified SQL statement. It includes the parameters sql_hash, plan_hash and explain_options.

    The parameter explain_options can be any comma-separated list of valid EXPLAIN options, as shown following.

    analyze,verbose,buffers,hashes,format json

    If the parameter explain_options is NULL or an empty string, the get_explain_stmt function generates a simple EXPLAIN statement.

    To create an EXPLAIN script for your workload or a portion of it, use the \a , \t, and \o options to redirect the output to a file. For example, you can create an EXPLAIN script for the top-ranked (top-K) statements by using the PostgreSQL pg_stat_statements view sorted by total_time in DESC order.

  3. The precise location of the Gather parallel query operator is determined by costing, and may change slightly over time. To prevent these differences from invalidating the entire plan, query plan management now computes the same plan_hash even if the Gather operators move to different places in the plan tree.

  4. Support is added for nonparameterized statements inside pl/pgsql functions.

  5. Overhead is reduced when the apg_plan_mgmt extension is installed on multiple databases in the same cluster while two or more databases are being accessed concurrently. Also, this release fixed a bug in this area that caused plans to not be stored in shared memory.

Extension improvements
  1. Improvements to the evolve_plan_baselines function.

    1. The evolve_plan_baselines function now computes a cardinality_error metric over all nodes in the plan. Using this metric, you can identify any plan where the cardinality estimation error is large, and the plan quality is more doubtful. Long-running statements with high cardinality_error values are high-priority candidates for query tuning.

    2. Reports generated by evolve_plan_baselines now include sql_hash, plan_hash, and the plan status.

    3. You can now allow evolve_plan_baselines to approve previously Rejected plans.

    4. The meaning of speedup_factor for evolve_plan_baselines is now always relative to the baseline plan. For example, a value of 1.1 now means 10 percent faster than the baseline plan. A value of 0.9 means 10 percent slower than the baseline plan. The comparison is made using running time alone instead of total time.

    5. The evolve_plan_baselines function now warms the cache in a new way. It does this by running the baseline plan, then running the baseline plan one more time, and then running the candidate plan once. Previously, evolve_plan_baselines ran the candidate plan twice. This approach added significantly to running time, especially for slow candidate plans. However, running the candidate plan twice is more reliable when the candidate plan uses an index that isn't used in the baseline plan.

  2. Query plan management no longer saves plans that refer to system tables or views, temporary tables, or the query plan management's own tables.

  3. Bug fixes include caching a plan immediately when saved and fixing a bug that caused the back end to terminate.