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?.
idx | array_position |
---|---|
4 | 4 |
SELECT 1
idx | array_position |
---|---|
0 | null |
SELECT 1
ERROR: array must not contain nulls
idx | array_position |
---|---|
null | 4 |
SELECT 1
array_position |
---|
7 |
SELECT 1
idx |
---|
5 |
SELECT 1
ERROR: searching for elements in multidimensional arrays is not supported
idx | array_position |
---|---|
3 | 7 |
SELECT 1
SELECT 125001
QUERY PLAN |
---|
Seq Scan on arr (cost=0.00..3480.30 rows=175304 width=4) (actual time=0.061..52.935 rows=125001 loops=1) |
Planning Time: 0.098 ms |
Execution Time: 57.581 ms |
EXPLAIN
QUERY PLAN |
---|
Seq Scan on arr (cost=0.00..3480.30 rows=175304 width=4) (actual time=0.035..28.507 rows=125001 loops=1) |
Planning Time: 0.048 ms |
Execution Time: 33.157 ms |
EXPLAIN
TRUNCATE TABLE
INSERT 0 6667
QUERY PLAN |
---|
Seq Scan on arr (cost=0.00..1501.20 rows=75616 width=4) (actual time=0.019..14.073 rows=6667 loops=1) |
Planning Time: 0.076 ms |
Execution Time: 14.333 ms |
EXPLAIN
QUERY PLAN |
---|
Seq Scan on arr (cost=0.00..1501.20 rows=75616 width=4) (actual time=0.010..1.902 rows=6667 loops=1) |
Planning Time: 0.032 ms |
Execution Time: 2.157 ms |
EXPLAIN