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 1000001
CREATE SEQUENCE
ALTER SEQUENCE
i | n1 | d | s | n2 |
---|---|---|---|---|
0 | 46137349 | 46137349 | 0 | 47137350 |
1000000 | 47137349 | 46137349 | 500000500000 | 47137351 |
SELECT 2
ALTER SEQUENCE
i | n1 | d | s | n2 |
---|---|---|---|---|
0 | 1 | 1 | 0 | 1000002 |
1000000 | 1000001 | 1 | 500000500000 | 1000003 |
SELECT 2
QUERY PLAN |
---|
Subquery Scan on unnamed_subquery (cost=153232.71..193245.20 rows=11395 width=36) |
Filter: ((unnamed_subquery.i = 0) OR (unnamed_subquery.i = 1000000)) |
-> WindowAgg (cost=153232.71..176080.71 rows=1142400 width=28) |
-> Sort (cost=153232.71..156088.71 rows=1142400 width=12) |
Sort Key: integers.i |
-> Seq Scan on integers (cost=0.00..18760.00 rows=1142400 width=12) |
JIT: |
Functions: 9 |
Options: Inlining false, Optimization false, Expressions true, Deforming true |
EXPLAIN