add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
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 table1 (col1 int, col2 int, col3 timestamp, col4 timestamp);

DO $$
DECLARE _now timestamp;
BEGIN
select now() into _now;
insert into table1 (col1, col2, col3, col4)
select
x.v,
x.v*10,
_now,
_now
from
generate_series(1, 10) x(v);
END $$;

select * from table1;
CREATE TABLE
DO
col1 col2 col3 col4
1 10 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
2 20 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
3 30 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
4 40 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
5 50 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
6 60 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
7 70 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
8 80 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
9 90 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
10 100 2023-12-20 11:35:43.987329 2023-12-20 11:35:43.987329
SELECT 10