Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Stable13 #29

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

Merged
danolivo merged 20 commits into postgrespro:stable13 from Alena0704:stable13
Jun 13, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
197145a
Prevent distributed deadlocks. Disable AQO for FDW queries.
danolivo Dec 3, 2020
626d5ee
Allow learning (and predicting for) on a ForeignScan, an Append, a Me...
danolivo Dec 4, 2020
386cd6d
Add support of postgres_fdw push-down.
danolivo Dec 4, 2020
0cd3ce3
Process GatherMergePath in get_path_clauses routine.
danolivo Dec 15, 2020
e8dcb5b
Add a foreign relation estimation hook into the core patch and AQO.
danolivo Jan 15, 2021
38d4f77
Add basic regression test on FDW support.
danolivo Jan 15, 2021
8291220
Add missed aqo_fdw.sql
danolivo Jan 19, 2021
9aff621
Prepare the insert_index routine for PGv14 signature
danolivo Jan 18, 2021
36c97ac
Change the license sentence in accordance with 2021.
danolivo Jan 19, 2021
34c640d
Fix the state:
danolivo Jan 19, 2021
fbf27d6
Rename aqo.details to aqo.show_details.
danolivo Jan 20, 2021
d8e18ce
Update the readme file in accordance with the new AQO version.
danolivo Jan 20, 2021
418c7d4
Bugfix of the aqo_fdw regress test
danolivo Jan 20, 2021
505c064
Update README.md
danolivo Feb 6, 2021
453bef5
Rename the aqo_details to aqo_show_details
danolivo Feb 18, 2021
d705b5d
Store selectivity cache data in the cache memory context instead of
danolivo Feb 18, 2021
2b20ff0
Change insert/update scheme for the ML-knowledge base.
danolivo Feb 18, 2021
436b3e6
Improve AQO makefile
danolivo Feb 18, 2021
8ec6572
Bugfix: don't create ignorance table in parallel worker.
danolivo Feb 18, 2021
d339ad0
Make the explain of AQO more readable.
danolivo Mar 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix the state:
AQO supports push-down of trivial JOIN and JOIN with mergejoinable clauses.
  • Loading branch information
danolivo authored and Alena0704 committed Jun 12, 2021
commit 34c640d40f511f236f2186a57e1ff8de1f85f360
54 changes: 48 additions & 6 deletions expected/aqo_fdw.out
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ CREATE TABLE local (x int);
CREATE FOREIGN TABLE frgn(x int) SERVER loopback OPTIONS (table_name 'local');
INSERT INTO frgn (x) VALUES (1);
ANALYZE local;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn;
-- Trivial foreign scan.s
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT x FROM frgn;
QUERY PLAN
-------------------------------------------------------------
Foreign Scan on frgn (actual rows=1 loops=1) (AQO not used)
Expand All @@ -30,7 +32,8 @@ EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn;
JOINS: 0
(4 rows)

EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT x FROM frgn;
QUERY PLAN
-----------------------------------------------------------------------------
Foreign Scan on frgn (actual rows=1 loops=1) (AQO: cardinality=1, error=0%)
Expand All @@ -39,8 +42,9 @@ EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn;
JOINS: 0
(4 rows)

-- Push down base filters.
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE) SELECT x FROM frgn WHERE x < 10;
-- Push down base filters. Use verbose mode to see filters.
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
SELECT x FROM frgn WHERE x < 10;
QUERY PLAN
--------------------------------------------------------------------
Foreign Scan on public.frgn (actual rows=1 loops=1) (AQO not used)
Expand All @@ -51,7 +55,8 @@ EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE) SELECT x FROM frg
JOINS: 0
(6 rows)

EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE) SELECT x FROM frgn WHERE x < 10;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
SELECT x FROM frgn WHERE x < 10;
QUERY PLAN
------------------------------------------------------------------------------------
Foreign Scan on public.frgn (actual rows=1 loops=1) (AQO: cardinality=1, error=0%)
Expand All @@ -62,7 +67,8 @@ EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE) SELECT x FROM frg
JOINS: 0
(6 rows)

EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn WHERE x < -10; -- AQO ignores constants
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT x FROM frgn WHERE x < -10; -- AQO ignores constants
QUERY PLAN
-------------------------------------------------------------------------------
Foreign Scan on frgn (actual rows=0 loops=1) (AQO: cardinality=1, error=100%)
Expand All @@ -71,4 +77,40 @@ EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn WHERE x
JOINS: 0
(4 rows)

-- Trivial JOIN push-down.
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT * FROM frgn AS a, frgn AS b WHERE a.x=b.x;
QUERY PLAN
---------------------------------------------------------------------------
Merge Join (actual rows=1 loops=1) (AQO not used)
Merge Cond: (a.x = b.x)
-> Sort (actual rows=1 loops=1) (AQO not used)
Sort Key: a.x
Sort Method: quicksort Memory: 25kB
-> Foreign Scan on frgn a (actual rows=1 loops=1) (AQO not used)
-> Sort (actual rows=1 loops=1) (AQO not used)
Sort Key: b.x
Sort Method: quicksort Memory: 25kB
-> Foreign Scan on frgn b (actual rows=1 loops=1) (AQO not used)
Using aqo: true
AQO mode: LEARN
JOINS: 0
(13 rows)

EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT * FROM frgn AS a, frgn AS b WHERE a.x=b.x;
QUERY PLAN
---------------------------------------------------------------------
Foreign Scan (actual rows=1 loops=1) (AQO: cardinality=1, error=0%)
Relations: (frgn a) INNER JOIN (frgn b)
Using aqo: true
AQO mode: LEARN
JOINS: 0
(5 rows)

-- Non-mergejoinable join condition
--EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
--SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;
--EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
--SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;
DROP EXTENSION aqo;
32 changes: 25 additions & 7 deletions sql/aqo_fdw.sql
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,31 @@ CREATE FOREIGN TABLE frgn(x int) SERVER loopback OPTIONS (table_name 'local');
INSERT INTO frgn (x) VALUES (1);
ANALYZE local;

EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn;

-- Push down base filters.
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE) SELECT x FROM frgn WHERE x < 10;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE) SELECT x FROM frgn WHERE x < 10;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF) SELECT x FROM frgn WHERE x < -10; -- AQO ignores constants
-- Trivial foreign scan.s
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT x FROM frgn;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT x FROM frgn;

-- Push down base filters. Use verbose mode to see filters.
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
SELECT x FROM frgn WHERE x < 10;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
SELECT x FROM frgn WHERE x < 10;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT x FROM frgn WHERE x < -10; -- AQO ignores constants

-- Trivial JOIN push-down.
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT * FROM frgn AS a, frgn AS b WHERE a.x=b.x;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
SELECT * FROM frgn AS a, frgn AS b WHERE a.x=b.x;

-- TODO: Non-mergejoinable join condition.
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF)
SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;
EXPLAIN (ANALYZE, COSTS OFF, SUMMARY OFF, TIMING OFF, VERBOSE)
SELECT * FROM frgn AS a, frgn AS b WHERE a.x<b.x;

DROP EXTENSION aqo;

AltStyle によって変換されたページ (->オリジナル) /