Skip to content

Commit be9baf5

Browse files
tvondraCommitfest Bot
authored andcommitted
Simplify planning of starjoin queries
1 parent 85b3801 commit be9baf5

File tree

8 files changed

+494
-0
lines changed

8 files changed

+494
-0
lines changed

patch/create-1.sql

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
create table dim1 (id int primary key, val1 text);
2+
create table dim2 (id int primary key, val2 text);
3+
create table dim3 (id int primary key, val3 text);
4+
create table dim4 (id int primary key, val4 text);
5+
create table dim5 (id int primary key, val5 text);
6+
create table dim6 (id int primary key, val6 text);
7+
create table dim7 (id int primary key, val7 text);
8+
9+
create table t (id serial primary key,
10+
id1 int references dim1(id),
11+
id2 int references dim2(id),
12+
id3 int references dim3(id),
13+
id4 int references dim4(id),
14+
id5 int references dim5(id),
15+
id6 int references dim6(id),
16+
id7 int references dim7(id));
17+
18+
vacuum analyze;

patch/create-2.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
create table t (id serial primary key, a text);
2+
3+
create table dim1 (id1 int primary key references t(id), val1 text);
4+
create table dim2 (id2 int primary key references t(id), val2 text);
5+
create table dim3 (id3 int primary key references t(id), val3 text);
6+
create table dim4 (id4 int primary key references t(id), val4 text);
7+
create table dim5 (id5 int primary key references t(id), val5 text);
8+
create table dim6 (id6 int primary key references t(id), val6 text);
9+
create table dim7 (id7 int primary key references t(id), val7 text);
10+
11+
vacuum analyze;

patch/select-1.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--set join_collapse_limit = 1;
2+
select * from t
3+
join dim1 on (dim1.id = id1)
4+
join dim2 on (dim2.id = id2)
5+
join dim3 on (dim3.id = id3)
6+
join dim4 on (dim4.id = id4)
7+
join dim5 on (dim5.id = id5)
8+
join dim6 on (dim6.id = id6)
9+
join dim7 on (dim7.id = id7);

patch/select-2.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- set join_collapse_limit = 1;
2+
select * from t
3+
left join dim1 on (id = id1)
4+
left join dim2 on (id = id2)
5+
left join dim3 on (id = id3)
6+
left join dim4 on (id = id4)
7+
left join dim5 on (id = id5)
8+
left join dim6 on (id = id6)
9+
left join dim7 on (id = id7);

0 commit comments

Comments
 (0)