By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
create table t(t_id int);
insert into t values (1),(2),(3),(4);
create table u(u_id int);
insert into u values (5),(6),(7);
create table v(v_id int);
CREATE TABLE
INSERT 0 4
CREATE TABLE
INSERT 0 3
CREATE TABLE
select * from t,u
t_id | u_id |
---|---|
1 | 5 |
1 | 6 |
1 | 7 |
2 | 5 |
2 | 6 |
2 | 7 |
3 | 5 |
3 | 6 |
3 | 7 |
4 | 5 |
4 | 6 |
4 | 7 |
SELECT 12
select * from t FULL OUTER JOIN u ON FALSE
t_id | u_id |
---|---|
null | 5 |
null | 6 |
null | 7 |
1 | null |
2 | null |
3 | null |
4 | null |
SELECT 7
select * from t,v
t_id | v_id |
---|
SELECT 0
select * from t FULL OUTER JOIN v ON FALSE
t_id | v_id |
---|---|
1 | null |
2 | null |
3 | null |
4 | null |
SELECT 4