-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9e2f8b6 forgot to contain the .sql and expected/.out files for hints_anywhere feature. Add them.
- Loading branch information
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
LOAD 'pg_hint_plan'; | ||
SET client_min_messages TO log; | ||
\set SHOW_CONTEXT always | ||
SET pg_hint_plan.debug_print TO on; | ||
explain (costs false) | ||
select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> ''; | ||
QUERY PLAN | ||
-------------------------------------- | ||
Merge Join | ||
Merge Cond: (t1.id = t2.id) | ||
-> Index Scan using t1_pkey on t1 | ||
-> Index Scan using t2_pkey on t2 | ||
(4 rows) | ||
|
||
set pg_hint_plan.hints_anywhere = on; | ||
explain (costs false) | ||
select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> ''; | ||
LOG: pg_hint_plan: | ||
used hint: | ||
HashJoin(t1 t2) | ||
not used hint: | ||
duplication hint: | ||
error hint: | ||
|
||
QUERY PLAN | ||
------------------------------ | ||
Hash Join | ||
Hash Cond: (t1.id = t2.id) | ||
-> Seq Scan on t1 | ||
-> Hash | ||
-> Seq Scan on t2 | ||
(5 rows) | ||
|
||
set pg_hint_plan.hints_anywhere = off; | ||
explain (costs false) | ||
select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> ''; | ||
QUERY PLAN | ||
-------------------------------------- | ||
Merge Join | ||
Merge Cond: (t1.id = t2.id) | ||
-> Index Scan using t1_pkey on t1 | ||
-> Index Scan using t2_pkey on t2 | ||
(4 rows) | ||
|
||
set pg_hint_plan.hints_anywhere = on; | ||
/*+ MergeJoin(t1 t2) */ | ||
explain (costs false) | ||
select * from t1 join t2 on t1.val = t2.val where '/*+HashJoin(t1 t2)*/' <> ''; | ||
LOG: pg_hint_plan: | ||
used hint: | ||
MergeJoin(t1 t2) | ||
not used hint: | ||
duplication hint: | ||
error hint: | ||
|
||
QUERY PLAN | ||
------------------------------------------- | ||
Merge Join | ||
Merge Cond: (t2.val = t1.val) | ||
-> Index Scan using t2_val on t2 | ||
-> Materialize | ||
-> Index Scan using t1_val on t1 | ||
(5 rows) | ||
|
||
/*+ HashJoin(t1 t2) */ | ||
explain (costs false) | ||
select * from t1 join t2 on t1.val = t2.val where '/*+MergeJoin(t1 t2)*/' <> ''; | ||
LOG: pg_hint_plan: | ||
used hint: | ||
HashJoin(t1 t2) | ||
not used hint: | ||
duplication hint: | ||
error hint: | ||
|
||
QUERY PLAN | ||
-------------------------------- | ||
Hash Join | ||
Hash Cond: (t2.val = t1.val) | ||
-> Seq Scan on t2 | ||
-> Hash | ||
-> Seq Scan on t1 | ||
(5 rows) | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
LOAD 'pg_hint_plan'; | ||
SET client_min_messages TO log; | ||
\set SHOW_CONTEXT always | ||
SET pg_hint_plan.debug_print TO on; | ||
|
||
explain (costs false) | ||
select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> ''; | ||
|
||
set pg_hint_plan.hints_anywhere = on; | ||
explain (costs false) | ||
select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> ''; | ||
|
||
set pg_hint_plan.hints_anywhere = off; | ||
explain (costs false) | ||
select * from t1 join t2 on t1.id = t2.id where '/*+HashJoin(t1 t2)*/' <> ''; | ||
|
||
set pg_hint_plan.hints_anywhere = on; | ||
/*+ MergeJoin(t1 t2) */ | ||
explain (costs false) | ||
select * from t1 join t2 on t1.val = t2.val where '/*+HashJoin(t1 t2)*/' <> ''; | ||
|
||
/*+ HashJoin(t1 t2) */ | ||
explain (costs false) | ||
select * from t1 join t2 on t1.val = t2.val where '/*+MergeJoin(t1 t2)*/' <> ''; |