add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
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?.
version
PostgreSQL 12.8 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.4.1 20200928 (Red Hat 8.4.1-1), 64-bit
1 rows affected
n m
3 5
x
1
2
3
3
2
1
1
2
3
3
2
1
1
2
3
3
2
1
1
2
3
3
2
1
1
2
3
3
2
1
QUERY PLAN
Nested Loop (cost=97.81..25142.81 rows=2000000 width=4) (actual time=0.044..0.073 rows=30 loops=1)
  Output: t.x
  Buffers: shared hit=3
  InitPlan 1 (returns $0)
    -> Seq Scan on public.param (cost=0.00..32.60 rows=2260 width=4) (actual time=0.005..0.005 rows=1 loops=1)
          Output: param.n
          Buffers: shared hit=1
  InitPlan 2 (returns $1)
    -> Seq Scan on public.param param_1 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.005..0.005 rows=1 loops=1)
          Output: param_1.n
          Buffers: shared hit=1
  InitPlan 3 (returns $2)
    -> Seq Scan on public.param param_2 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.007..0.008 rows=1 loops=1)
          Output: param_2.m
          Buffers: shared hit=1
  -> Function Scan on pg_catalog.generate_series (cost=0.00..10.00 rows=1000 width=0) (actual time=0.023..0.023 rows=5 loops=1)
        Output: generate_series.generate_series
        Function Call: generate_series(1, $2)
        Buffers: shared hit=1
  -> Materialize (cost=0.00..40.00 rows=2000 width=4) (actual time=0.004..0.009 rows=6 loops=5)
        Output: t.x
        Buffers: shared hit=2
        -> Append (cost=0.00..30.00 rows=2000 width=4) (actual time=0.016..0.036 rows=6 loops=1)
              Buffers: shared hit=2
              -> Function Scan on pg_catalog.generate_series t (cost=0.00..10.00 rows=1000 width=4) (actual time=0.015..0.016 rows=3 loops=1)
                    Output: t.x
                    Function Call: generate_series(1, $0)
                    Buffers: shared hit=1
              -> Function Scan on pg_catalog.generate_series t_1 (cost=0.00..10.00 rows=1000 width=4) (actual time=0.018..0.018 rows=3 loops=1)
                    Output: t_1.x
                    Function Call: generate_series($1, 1, '-1'::integer)
                    Buffers: shared hit=1
Planning Time: 0.135 ms
Execution Time: 0.128 ms