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
CREATE TABLE
CREATE INDEX
INSERT 0 4
INSERT 0 4
ERROR: duplicate key value violates unique constraint "a_user_id_key" DETAIL: Key (user_id)=(3) already exists.
UPDATE 1
id | user_id | f_id |
---|---|---|
1 | 1 | 11 |
2 | 3 | 22 |
3 | 2 | 33 |
4 | 4 | 44 |
SELECT 4