Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG17 compatibility: fix multi-1 diffs caused by PG17 optimizer enhancements #7769

Open
wants to merge 1 commit into
base: naisila/pg17_support
Choose a base branch
from

Conversation

colm-mchugh
Copy link
Contributor

@colm-mchugh colm-mchugh commented Nov 25, 2024

This fix restores the expected DEBUG error messages from the router planner in multi_router_planner, multi_router_planner_fast_path and query_single_shard_table. In the case of query_single_shard_table the diffs are because of this PG17 commit, which enables the optimizer to pull up a correlated ANY subquery to a join. The fix inhibits subquery pull up by including a volatile function in the predicate involving the ANY subquery.

In the case of multi_router_planner and multi_router_planner_fast_path the diffs are because of this PG17 commit, which enables the optimizer to detect and remove redundant IS (NOT) NULL expressions. The fix is to adjust the table definition so the column used for distribution is not marked NOT NULL, thus preserving .

Finallly, the DEBUG logging level is lowered for CREATE MATERIALIZED VIEW AS statements in multi_router_planner and multi_router_planner_fast_path because of this PG17 commit; when creating materialized views, use REFRESH logic to load data. A consequence of this is that with client_min_messages at DEBUG2 the following is emitted for CREATE MATERIALIZED VIEW AS statements: drop auto-cascades to type multi_router_planner.pg_temp_42245 . This is part of the REFRESH logic, and also relevant is this PG17 commit which sets the search_path to 'pg_catalog, pg_temp' during maintenance operations (including REFRESH MATERIALIZED VIEW)

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.61%. Comparing base (c396ce6) to head (0ec4a68).

Additional details and impacted files
@@                   Coverage Diff                    @@
##           naisila/pg17_support    #7769      +/-   ##
========================================================
- Coverage                 89.62%   89.61%   -0.01%     
========================================================
  Files                       274      274              
  Lines                     59689    59689              
  Branches                   7446     7446              
========================================================
- Hits                      53495    53492       -3     
  Misses                     4065     4065              
- Partials                   2129     2132       +3     

multi_router_planner_fast_path and query_single_shard_table

Restore the expected DEBUG error messages from the router planner.
In the case of query_single_shard_table the diffs are because of
PG17's ability to pull up correlated ANY subqueries (*). The fix
is to inhibit pull up with a volatile function.

In the case of multi_router_planner and multi_router_planner_fast_path
the diffs are because of PG17's ability to remove redundant IS (NOT)
NULL expressions (**). The fix is to adjust the table definition so
the column used for distribution is not marked NOT NULL.

(*) https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=9f1337639
(**) https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b262ad440
@colm-mchugh colm-mchugh force-pushed the cmchugh/pg17-multi-1-query-adjustments branch from 41b873f to 0ec4a68 Compare November 26, 2024 10:32
@colm-mchugh colm-mchugh changed the title PG17 regress sanity: fix multi-1 diffs caused by PG17 optimizer enhancements PG17 compatibility: fix multi-1 diffs caused by PG17 optimizer enhancements Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant