Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/backend/utils/misc/guc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ static struct config_int ConfigureNamesInt[] =
"list of no more than this many items would result.")
},
&join_collapse_limit,
20, 1, INT_MAX,
13, 1, INT_MAX,
NULL, NULL, NULL
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/backend/utils/misc/postgresql.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ max_prepared_transactions = 250 # can be 0 or more

#cursor_tuple_fraction = 0.1 # range 0.0-1.0
#from_collapse_limit = 20
#join_collapse_limit = 20 # 1 disables collapsing of explicit
#join_collapse_limit = 13 # 1 disables collapsing of explicit
# JOIN clauses
#gp_segments_for_planner = 0 # if 0, actual number of segments is used

Expand Down
42 changes: 42 additions & 0 deletions src/test/regress/expected/bfv_joins.out
Original file line number Diff line number Diff line change
Expand Up @@ -4195,6 +4195,48 @@ cross join lateral
union
select a+1, b from t1 where a+1 < 10) x;
ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3701)
-- Check that Postgres Planner can build a plan with 20 joins in reasonable time
do $$
begin
for i in 1..20 loop
execute 'create table tj' || i || '(id int) distributed by (id)';
end loop;
end
$$;
set optimizer to off;
select trunc(extract(epoch from now())) unix_time1 \gset
select *
from tj1
join tj2 on tj1.id = tj2.id
join tj3 on tj2.id = tj3.id
join tj4 on tj3.id = tj4.id
join tj5 on tj4.id = tj5.id
join tj6 on tj5.id = tj6.id
join tj7 on tj6.id = tj7.id
join tj8 on tj7.id = tj8.id
join tj9 on tj8.id = tj9.id
join tj10 on tj9.id = tj10.id
join tj11 on tj10.id = tj11.id
join tj12 on tj11.id = tj12.id
join tj13 on tj12.id = tj13.id
join tj14 on tj13.id = tj14.id
join tj15 on tj14.id = tj15.id
join tj16 on tj15.id = tj16.id
join tj17 on tj16.id = tj17.id
join tj18 on tj17.id = tj18.id
join tj19 on tj18.id = tj19.id
join tj20 on tj19.id = tj20.id;
id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id
----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----
(0 rows)

select (trunc(extract(epoch from now())) - :unix_time1) < 100 is_ok;
is_ok
-------
t
(1 row)

reset optimizer;
-- Clean up. None of the objects we create are very interesting to keep around.
reset search_path;
set client_min_messages='warning';
Expand Down
42 changes: 42 additions & 0 deletions src/test/regress/expected/bfv_joins_optimizer.out
Original file line number Diff line number Diff line change
Expand Up @@ -4188,6 +4188,48 @@ cross join lateral
union
select a+1, b from t1 where a+1 < 10) x;
ERROR: Passing parameters across motion is not supported. (cdbmutate.c:3701)
-- Check that Postgres Planner can build a plan with 20 joins in reasonable time
do $$
begin
for i in 1..20 loop
execute 'create table tj' || i || '(id int) distributed by (id)';
end loop;
end
$$;
set optimizer to off;
select trunc(extract(epoch from now())) unix_time1 \gset
select *
from tj1
join tj2 on tj1.id = tj2.id
join tj3 on tj2.id = tj3.id
join tj4 on tj3.id = tj4.id
join tj5 on tj4.id = tj5.id
join tj6 on tj5.id = tj6.id
join tj7 on tj6.id = tj7.id
join tj8 on tj7.id = tj8.id
join tj9 on tj8.id = tj9.id
join tj10 on tj9.id = tj10.id
join tj11 on tj10.id = tj11.id
join tj12 on tj11.id = tj12.id
join tj13 on tj12.id = tj13.id
join tj14 on tj13.id = tj14.id
join tj15 on tj14.id = tj15.id
join tj16 on tj15.id = tj16.id
join tj17 on tj16.id = tj17.id
join tj18 on tj17.id = tj18.id
join tj19 on tj18.id = tj19.id
join tj20 on tj19.id = tj20.id;
id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id | id
----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----
(0 rows)

select (trunc(extract(epoch from now())) - :unix_time1) < 100 is_ok;
is_ok
-------
t
(1 row)

reset optimizer;
-- Clean up. None of the objects we create are very interesting to keep around.
reset search_path;
set client_min_messages='warning';
Expand Down
39 changes: 39 additions & 0 deletions src/test/regress/sql/bfv_joins.sql
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,45 @@ cross join lateral
union
select a+1, b from t1 where a+1 < 10) x;

-- Check that Postgres Planner can build a plan with 20 joins in reasonable time
do $$
begin
for i in 1..20 loop
execute 'create table tj' || i || '(id int) distributed by (id)';
end loop;
end
$$;

set optimizer to off;

select trunc(extract(epoch from now())) unix_time1 \gset

select *
from tj1
join tj2 on tj1.id = tj2.id
join tj3 on tj2.id = tj3.id
join tj4 on tj3.id = tj4.id
join tj5 on tj4.id = tj5.id
join tj6 on tj5.id = tj6.id
join tj7 on tj6.id = tj7.id
join tj8 on tj7.id = tj8.id
join tj9 on tj8.id = tj9.id
join tj10 on tj9.id = tj10.id
join tj11 on tj10.id = tj11.id
join tj12 on tj11.id = tj12.id
join tj13 on tj12.id = tj13.id
join tj14 on tj13.id = tj14.id
join tj15 on tj14.id = tj15.id
join tj16 on tj15.id = tj16.id
join tj17 on tj16.id = tj17.id
join tj18 on tj17.id = tj18.id
join tj19 on tj18.id = tj19.id
join tj20 on tj19.id = tj20.id;

select (trunc(extract(epoch from now())) - :unix_time1) < 100 is_ok;

reset optimizer;

-- Clean up. None of the objects we create are very interesting to keep around.
reset search_path;
set client_min_messages='warning';
Expand Down
Loading