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?.
select version();
version
PostgreSQL 15.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10), 64-bit
SELECT 1
Create table public.values_with_variable_view( id integer NOT NULL,
"timestamp" timestamp with time zone NOT NULL, intvalue bigint);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1000,'2024-01-04 01:07:10.554192+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (2000,'2024-01-04 01:08:09.267336+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (999,'2024-01-04 01:08:10.554191+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1999,'2024-01-04 01:09:09.267335+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (998,'2024-01-04 01:09:10.554191+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1998,'2024-01-04 01:10:09.267335+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (997,'2024-01-04 01:10:10.55419+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1997,'2024-01-04 01:11:09.267335+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (996,'2024-01-04 01:11:10.55419+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1996,'2024-01-04 01:12:09.267335+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (995,'2024-01-04 01:12:10.55419+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1995,'2024-01-04 01:13:09.267334+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (994,'2024-01-04 01:13:10.554189+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1994,'2024-01-04 01:14:09.267334+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (993,'2024-01-04 01:14:10.554189+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1993,'2024-01-04 01:15:09.267334+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (992,'2024-01-04 01:15:10.554189+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1992,'2024-01-04 01:16:09.267334+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (991,'2024-01-04 01:16:10.554188+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1991,'2024-01-04 01:17:09.267333+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (990,'2024-01-04 01:17:10.554188+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1990,'2024-01-04 01:18:09.267333+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (989,'2024-01-04 01:18:10.554188+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (1989,'2024-01-04 01:19:09.267333+00',10);
INSERT INTO public."values_with_variable_view"(id, "timestamp", intvalue) VALUES (988,'2024-01-04 01:19:10.554187+00',10);

select * from values_with_variable_view;

--alternate to make it work with LINQ
select * from values_with_variable_view
where timestamp > '2024-01-04 01:12:09.267335+00'
and
id > 1996
order by timestamp, id;
CREATE TABLE
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 1
id timestamp intvalue
1000 2024-01-04 01:07:10.554192+00 10
2000 2024-01-04 01:08:09.267336+00 10
999 2024-01-04 01:08:10.554191+00 10
1999 2024-01-04 01:09:09.267335+00 10
998 2024-01-04 01:09:10.554191+00 10
1998 2024-01-04 01:10:09.267335+00 10
997 2024-01-04 01:10:10.55419+00 10
1997 2024-01-04 01:11:09.267335+00 10
996 2024-01-04 01:11:10.55419+00 10
1996 2024-01-04 01:12:09.267335+00 10
995 2024-01-04 01:12:10.55419+00 10
1995 2024-01-04 01:13:09.267334+00 10
994 2024-01-04 01:13:10.554189+00 10
1994 2024-01-04 01:14:09.267334+00 10
993 2024-01-04 01:14:10.554189+00 10
1993 2024-01-04 01:15:09.267334+00 10
992 2024-01-04 01:15:10.554189+00 10
1992 2024-01-04 01:16:09.267334+00 10
991 2024-01-04 01:16:10.554188+00 10
1991 2024-01-04 01:17:09.267333+00 10
990 2024-01-04 01:17:10.554188+00 10
1990 2024-01-04 01:18:09.267333+00 10
989 2024-01-04 01:18:10.554188+00 10
1989 2024-01-04 01:19:09.267333+00 10
988 2024-01-04 01:19:10.554187+00 10
SELECT 25
id timestamp intvalue
SELECT 0
id timestamp intvalue
995 2024-01-04 01:12:10.55419+00 10
1995 2024-01-04 01:13:09.267334+00 10
994 2024-01-04 01:13:10.554189+00 10
1994 2024-01-04 01:14:09.267334+00 10
993 2024-01-04 01:14:10.554189+00 10
1993 2024-01-04 01:15:09.267334+00 10
992 2024-01-04 01:15:10.554189+00 10
1992 2024-01-04 01:16:09.267334+00 10
991 2024-01-04 01:16:10.554188+00 10
1991 2024-01-04 01:17:09.267333+00 10
990 2024-01-04 01:17:10.554188+00 10
1990 2024-01-04 01:18:09.267333+00 10
989 2024-01-04 01:18:10.554188+00 10
1989 2024-01-04 01:19:09.267333+00 10
988 2024-01-04 01:19:10.554187+00 10
SELECT 15