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 persons (person_id int, person_name text);
create table places (place_id int, person_id int, place_name text);
insert into persons values (10, 'Aulus Agerius'), (20, 'Numerius Negidius');
insert into places values (10, 10, 'Anytown'), (20, 10, 'Timbuktu'), (30, 20, 'Podunk');
CREATE TABLE
CREATE TABLE
INSERT 0 2
INSERT 0 3
select person_name, place_name
from persons join places using (person_id)
order by person_id, place_id;
person_name | place_name |
---|---|
Aulus Agerius | Anytown |
Aulus Agerius | Timbuktu |
Numerius Negidius | Podunk |
SELECT 3