[AQUMV] Store view query in gp_matview_aux for view matching.#1117
Merged
my-ship-it merged 1 commit intoapache:mainfrom May 23, 2025
Merged
[AQUMV] Store view query in gp_matview_aux for view matching.#1117my-ship-it merged 1 commit intoapache:mainfrom
my-ship-it merged 1 commit intoapache:mainfrom
Conversation
yjhjstz
reviewed
May 21, 2025
yjhjstz
reviewed
May 23, 2025
yjhjstz
approved these changes
May 23, 2025
Move materialized views SQLs for AQUMV from pg_rewrite to
gp_matview_aux. This would allow for quicker access and
filtering, bypassing the evaluation of the system's 200
built-in rule entries that are often irrelevant.
before this commit:
set enable_answer_query_using_materialized_views = off;
explain(analyze, costs off, verbose) select count(a) from
t_select;
QUERY PLAN
------------------------------------------------------------------
Finalize Aggregate (actual time=0.000..0.000 rows=1 loops=1)
Output: count(a)
-> Gather Motion 3:1 (slice1; segments: 3) (actual
time=0.000..0.000 rows=3 loops=1)
Output: (PARTIAL count(a))
-> Partial Aggregate (actual time=0.000..0.000 rows=1 loops=1)
Output: PARTIAL count(a)
-> Seq Scan on public.t_select (actual time=0.000..0.000
rows=340 loops=1)
Output: a
Settings: enable_answer_query_using_materialized_views = 'off',
optimizer = 'off'
Planning Time: 0.462 ms
(slice0) Executor memory: 114K bytes.
(slice1) Executor memory: 112K bytes avg x 3x(0) workers, 112K
bytes max (seg0).
Memory used: 128000kB
Optimizer: Postgres query optimizer
Execution Time: 1.898 ms
(15 rows)
enable_answer_query_using_materialized_views = off
Planning Time: 0.462 ms
after this commit:
explain(analyze, costs off, verbose) select count(a) from
t_select;
QUERY PLAN
-----------------------------------------------------------------------
Finalize Aggregate (actual time=4.000..4.000 rows=1 loops=1)
Output: count(a)
-> Gather Motion 3:1 (slice1; segments: 3) (actual
time=4.000..4.000 rows=3 loops=1)
Output: (PARTIAL count(a))
-> Partial Aggregate (actual time=4.000..4.000 rows=1 loops=1)
Output: PARTIAL count(a)
-> Seq Scan on public.t_select (actual time=4.000..4.000
rows=0 loops=1)
Output: a
Settings: enable_answer_query_using_materialized_views = 'on',
optimizer = 'off'
Planning Time: 0.623 ms
(slice0) Executor memory: 114K bytes.
(slice1) Executor memory: 112K bytes avg x 3x(0) workers, 112K
bytes max (seg0).
Memory used: 128000kB
Optimizer: Postgres query optimizer
Execution Time: 1.670 ms
(15 rows)
enable_answer_query_using_materialized_views = off
Planning Time: 0.623 ms
Authored-by: Zhang Mingli avamingli@gmail.com
my-ship-it
approved these changes
May 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move materialized views SQLs for AQUMV from pg_rewrite to gp_matview_aux.
This would allow for quicker access and filtering, bypassing the evaluation of the system's 200 built-in rule entries that are often irrelevant.
before this commits:
Planning Time: 78.942 ms
after this commits:
Planning Time: 0.623 ms
Authored-by: Zhang Mingli avamingli@gmail.com
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions