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
INSERT 0 1
QUERY PLAN |
---|
Result (cost=0.00..7095.45 rows=60000 width=228) (actual time=0.199..0.203 rows=1 loops=1) |
Buffers: shared hit=1 |
-> ProjectSet (cost=0.00..345.45 rows=60000 width=68) (actual time=0.133..0.136 rows=1 loops=1) |
Buffers: shared hit=1 |
-> ProjectSet (cost=0.00..28.95 rows=600 width=36) (actual time=0.109..0.111 rows=1 loops=1) |
Buffers: shared hit=1 |
-> Seq Scan on slices (cost=0.00..25.88 rows=6 width=36) (actual time=0.013..0.015 rows=1 loops=1) |
Filter: (id = 169) |
Buffers: shared hit=1 |
Planning Time: 0.435 ms |
Execution Time: 0.577 ms |
EXPLAIN
QUERY PLAN |
---|
Nested Loop (cost=0.00..4845.51 rows=60000 width=228) (actual time=0.104..0.109 rows=1 loops=1) |
Buffers: shared hit=1 |
-> Seq Scan on slices (cost=0.00..25.88 rows=6 width=36) (actual time=0.012..0.014 rows=1 loops=1) |
Filter: (id = 169) |
Buffers: shared hit=1 |
-> Result (cost=0.00..428.27 rows=10000 width=64) (actual time=0.072..0.074 rows=1 loops=1) |
-> ProjectSet (cost=0.00..53.27 rows=10000 width=64) (actual time=0.067..0.069 rows=1 loops=1) |
-> ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.047..0.047 rows=1 loops=1) |
-> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=1) |
Planning Time: 0.140 ms |
Execution Time: 0.183 ms |
EXPLAIN
QUERY PLAN |
---|
Nested Loop (cost=0.00..3665.01 rows=60000 width=228) (actual time=0.096..0.102 rows=1 loops=1) |
Buffers: shared hit=1 |
-> Nested Loop (cost=0.00..53.01 rows=600 width=36) (actual time=0.042..0.045 rows=1 loops=1) |
Buffers: shared hit=1 |
-> Seq Scan on slices (cost=0.00..25.88 rows=6 width=36) (actual time=0.010..0.012 rows=1 loops=1) |
Filter: (id = 169) |
Buffers: shared hit=1 |
-> Result (cost=0.00..2.52 rows=100 width=32) (actual time=0.029..0.030 rows=1 loops=1) |
-> ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.025..0.026 rows=1 loops=1) |
-> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=1) |
-> Result (cost=0.00..2.27 rows=100 width=32) (actual time=0.027..0.028 rows=1 loops=1) |
-> ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.019..0.021 rows=1 loops=1) |
-> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=1) |
Planning Time: 0.096 ms |
Execution Time: 0.184 ms |
EXPLAIN