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 if not exists employee (
-- id serial primary key,
id int generated always as identity,
name varchar(255)
);
CREATE TABLE
insert into employee (name) values ('a'), ('b');
select * from employee;
delete from employee;
insert into employee (name) values ('a'), ('b');
select * from employee;
INSERT 0 2
id | name |
---|---|
1 | a |
2 | b |
SELECT 2
DELETE 2
INSERT 0 2
id | name |
---|---|
3 | a |
4 | b |
SELECT 2
insert into employee (name) values ('a'), ('b');
select * from employee;
truncate table employee restart identity;
insert into employee (name) values ('a'), ('b');
select * from employee;
INSERT 0 2
id | name |
---|---|
3 | a |
4 | b |
5 | a |
6 | b |
SELECT 4
TRUNCATE TABLE
INSERT 0 2
id | name |
---|---|
1 | a |
2 | b |
SELECT 2