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 person(
id BIGINT,
name VARCHAR(50),
last_name VARCHAR(50)
)
CREATE TABLE
alter table person add column full_name text generated always as
(name || last_name) stored;
ALTER TABLE
insert into person (id, name, last_name) values (1, 'a', 'b')
INSERT 0 1
select * from person
id | name | last_name | full_name |
---|---|---|---|
1 | a | b | ab |
SELECT 1