add remove split language chart show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
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
array_cat
{1,2,3,3,2,1}
unnest
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
ProjectSet (cost=107.85..175.35 rows=10000 width=4) (actual time=0.042..0.048 rows=30 loops=1)
  Output: unnest($4)
  Buffers: shared hit=3
  InitPlan 5 (returns $4)
    -> Result (cost=75.23..75.25 rows=1 width=32) (actual time=0.022..0.023 rows=1 loops=1)
          Output: array_cat($1, sort($3, 'DESC'::text))
          Buffers: shared hit=2
          InitPlan 2 (returns $1)
            -> ProjectSet (cost=32.60..37.62 rows=1000 width=4) (actual time=0.010..0.011 rows=3 loops=1)
                  Output: generate_series(1, $0)
                  Buffers: shared hit=1
                  InitPlan 1 (returns $0)
                    -> Seq Scan on public.param (cost=0.00..32.60 rows=2260 width=4) (actual time=0.004..0.005 rows=1 loops=1)
                          Output: param.n
                          Buffers: shared hit=1
                  -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=1)
          InitPlan 4 (returns $3)
            -> ProjectSet (cost=32.60..37.62 rows=1000 width=4) (actual time=0.006..0.007 rows=3 loops=1)
                  Output: generate_series(1, $2)
                  Buffers: shared hit=1
                  InitPlan 3 (returns $2)
                    -> Seq Scan on public.param param_1 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.004..0.004 rows=1 loops=1)
                          Output: param_1.n
                          Buffers: shared hit=1
                  -> Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=1)
  InitPlan 6 (returns $5)
    -> Seq Scan on public.param param_2 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.007..0.007 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.018..0.018 rows=5 loops=1)
        Output: generate_series.generate_series
        Function Call: generate_series(1, $5)
        Buffers: shared hit=1
Planning Time: 0.154 ms
Execution Time: 0.112 ms