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?.
396 rows affected
count | count |
---|---|
396 | 8 |
QUERY PLAN |
---|
Aggregate (cost=1.17..1.18 rows=1 width=8) (actual time=0.028..0.028 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Seq Scan on public.demo1 (cost=0.00..1.14 rows=11 width=0) (actual time=0.023..0.024 rows=11 loops=1) |
Filter: (demo1.n = 1) |
Buffers: shared hit=1 |
Planning Time: 0.106 ms |
Execution Time: 0.055 ms |
QUERY PLAN |
---|
Aggregate (cost=1.33..1.34 rows=1 width=8) (actual time=0.014..0.014 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Seq Scan on public.demo2 (cost=0.00..1.27 rows=22 width=0) (actual time=0.008..0.010 rows=22 loops=1) |
Filter: (demo2.n = 2) |
Buffers: shared hit=1 |
Planning Time: 0.063 ms |
Execution Time: 0.026 ms |
QUERY PLAN |
---|
Aggregate (cost=1.50..1.51 rows=1 width=8) (actual time=0.015..0.015 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Seq Scan on public.demo3 (cost=0.00..1.41 rows=33 width=0) (actual time=0.008..0.011 rows=33 loops=1) |
Filter: (demo3.n = 3) |
Buffers: shared hit=1 |
Planning Time: 0.053 ms |
Execution Time: 0.027 ms |
QUERY PLAN |
---|
Aggregate (cost=1.66..1.67 rows=1 width=8) (actual time=0.016..0.017 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Seq Scan on public.demo4 (cost=0.00..1.55 rows=44 width=0) (actual time=0.008..0.012 rows=44 loops=1) |
Filter: (demo4.n = 4) |
Buffers: shared hit=1 |
Planning Time: 0.051 ms |
Execution Time: 0.028 ms |
QUERY PLAN |
---|
Aggregate (cost=1.82..1.83 rows=1 width=8) (actual time=0.018..0.018 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Seq Scan on public.demo5 (cost=0.00..1.69 rows=55 width=0) (actual time=0.008..0.013 rows=55 loops=1) |
Filter: (demo5.n = 5) |
Buffers: shared hit=1 |
Planning Time: 0.050 ms |
Execution Time: 0.029 ms |
QUERY PLAN |
---|
Aggregate (cost=1.99..2.00 rows=1 width=8) (actual time=0.020..0.020 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Seq Scan on public.demo6 (cost=0.00..1.83 rows=66 width=0) (actual time=0.008..0.014 rows=66 loops=1) |
Filter: (demo6.n = 6) |
Buffers: shared hit=1 |
Planning Time: 0.175 ms |
Execution Time: 0.032 ms |
QUERY PLAN |
---|
Aggregate (cost=15.92..15.93 rows=1 width=8) (actual time=0.028..0.029 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Append (cost=0.00..14.93 rows=396 width=0) (actual time=0.008..0.023 rows=77 loops=1) |
Buffers: shared hit=1 |
Subplans Removed: 7 |
-> Seq Scan on public.demo7 (cost=0.00..1.96 rows=77 width=0) (actual time=0.008..0.016 rows=77 loops=1) |
Filter: (demo7.n = $1) |
Buffers: shared hit=1 |
Planning Time: 0.006 ms |
Execution Time: 0.054 ms |
QUERY PLAN |
---|
Aggregate (cost=15.92..15.93 rows=1 width=8) (actual time=0.032..0.032 rows=1 loops=1) |
Output: count(*) |
Buffers: shared hit=1 |
-> Append (cost=0.00..14.93 rows=396 width=0) (actual time=0.009..0.025 rows=88 loops=1) |
Buffers: shared hit=1 |
Subplans Removed: 7 |
-> Seq Scan on public.demo8 (cost=0.00..2.10 rows=88 width=0) (actual time=0.008..0.018 rows=88 loops=1) |
Filter: (demo8.n = $1) |
Buffers: shared hit=1 |
Planning Time: 0.006 ms |
Execution Time: 0.048 ms |