By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
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
CREATE INDEX
| QUERY PLAN |
|---|
| Limit (cost=1.50..1.52 rows=8 width=52) (actual time=0.080..0.083 rows=15 loops=1) |
| -> Sort (cost=1.50..1.52 rows=8 width=52) (actual time=0.079..0.080 rows=15 loops=1) |
| Sort Key: (ROW("timestamp", id)) |
| Sort Method: quicksort Memory: 27kB |
| -> Seq Scan on values_with_variable_view (cost=0.00..1.38 rows=8 width=52) (actual time=0.013..0.017 rows=15 loops=1) |
| Filter: (ROW("timestamp", id) > ROW('2024-01-04 01:12:09.267335+00'::timestamp with time zone, 1996)) |
| Rows Removed by Filter: 10 |
| Planning Time: 0.530 ms |
| Execution Time: 0.152 ms |
EXPLAIN
| 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
| QUERY PLAN |
|---|
| Limit (cost=1.58..1.60 rows=9 width=20) (actual time=0.021..0.024 rows=15 loops=1) |
| -> Sort (cost=1.58..1.60 rows=9 width=20) (actual time=0.020..0.022 rows=15 loops=1) |
| Sort Key: "timestamp", id |
| Sort Method: quicksort Memory: 26kB |
| -> Seq Scan on values_with_variable_view (cost=0.00..1.44 rows=9 width=20) (actual time=0.012..0.014 rows=15 loops=1) |
| Filter: ((("timestamp" = '2024-01-04 01:12:09.267335+00'::timestamp with time zone) AND (id > 1996)) OR ("timestamp" > '2024-01-04 01:12:09.267335+00'::timestamp with time zone)) |
| Rows Removed by Filter: 10 |
| Planning Time: 0.137 ms |
| Execution Time: 0.040 ms |
EXPLAIN
| 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
| QUERY PLAN |
|---|
| Limit (cost=1.50..1.51 rows=5 width=20) (actual time=0.019..0.022 rows=15 loops=1) |
| -> Sort (cost=1.50..1.51 rows=5 width=20) (actual time=0.018..0.020 rows=15 loops=1) |
| Sort Key: "timestamp", id |
| Sort Method: quicksort Memory: 26kB |
| -> Seq Scan on values_with_variable_view (cost=0.00..1.44 rows=5 width=20) (actual time=0.010..0.013 rows=15 loops=1) |
| Filter: (("timestamp" >= '2024-01-04 01:12:09.267335+00'::timestamp with time zone) AND (("timestamp" > '2024-01-04 01:12:09.267335+00'::timestamp with time zone) OR (id > 1996))) |
| Rows Removed by Filter: 10 |
| Planning Time: 0.078 ms |
| Execution Time: 0.037 ms |
EXPLAIN
| 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