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 my_table
(id, name, status, realm_id)as values
(1, 'cash', 'denied', 123)
,(2, 'check', 'closed', 123)
,(3, 'payroll','denied', 123)
,(4, 'cash', 'pending', 456)
,(5, 'deposit','suspended', 456)
,(6, 'lending','expired', 456)
,(7, 'loan', 'trial', 456)
,(8, 'crypto', 'active', 456)
,(9, 'payroll','closed', 456);
table my_table;
SELECT 9
id | name | status | realm_id |
---|---|---|---|
1 | cash | denied | 123 |
2 | check | closed | 123 |
3 | payroll | denied | 123 |
4 | cash | pending | 456 |
5 | deposit | suspended | 456 |
6 | lending | expired | 456 |
7 | loan | trial | 456 |
8 | crypto | active | 456 |
9 | payroll | closed | 456 |
SELECT 9