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
20001 rows affected
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
Sort (cost=1390.87..1409.78 rows=7565 width=8) (actual time=2.100..2.103 rows=30 loops=1)
  Output: (CASE WHEN ((int_seq.i % ($0 * 2)) < $1) THEN ((int_seq.i % ($2 * 2)) + 1) ELSE (($3 * 2) - (int_seq.i % ($4 * 2))) END), int_seq.i
  Sort Key: int_seq.i
  Sort Method: quicksort Memory: 26kB
  Buffers: shared hit=96
  InitPlan 1 (returns $0)
    -> Seq Scan on public.param (cost=0.00..32.60 rows=2260 width=4) (actual time=0.003..0.004 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.003..0.003 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.003..0.003 rows=1 loops=1)
          Output: param_2.n
          Buffers: shared hit=1
  InitPlan 4 (returns $3)
    -> Seq Scan on public.param param_3 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.004..0.004 rows=1 loops=1)
          Output: param_3.n
          Buffers: shared hit=1
  InitPlan 5 (returns $4)
    -> Seq Scan on public.param param_4 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.003..0.004 rows=1 loops=1)
          Output: param_4.n
          Buffers: shared hit=1
  InitPlan 6 (returns $5)
    -> Seq Scan on public.param param_5 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.005..0.005 rows=1 loops=1)
          Output: param_5.n
          Buffers: shared hit=1
  InitPlan 7 (returns $6)
    -> Seq Scan on public.param param_6 (cost=0.00..32.60 rows=2260 width=4) (actual time=0.003..0.004 rows=1 loops=1)
          Output: param_6.m
          Buffers: shared hit=1
  -> Seq Scan on public.int_seq (cost=0.00..675.29 rows=7565 width=8) (actual time=0.042..2.090 rows=30 loops=1)
        Output: CASE WHEN ((int_seq.i % ($0 * 2)) < $1) THEN ((int_seq.i % ($2 * 2)) + 1) ELSE (($3 * 2) - (int_seq.i % ($4 * 2))) END, int_seq.i
        Filter: (int_seq.i < (($5 * 2) * $6))
        Rows Removed by Filter: 19971
        Buffers: shared hit=96
Planning Time: 0.187 ms
Execution Time: 2.155 ms
generate_up_down_series
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
Function Scan on public.generate_up_down_series (cost=65.45..75.45 rows=1000 width=4) (actual time=0.129..0.131 rows=30 loops=1)
  Output: generate_up_down_series.generate_up_down_series
  Function Call: generate_up_down_series($0, $1)
  Buffers: shared hit=2
  InitPlan 1 (returns $0)
    -> Seq Scan on public.param (cost=0.00..32.60 rows=2260 width=4) (actual time=0.007..0.007 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.004..0.004 rows=1 loops=1)
          Output: param_1.m
          Buffers: shared hit=1
Planning Time: 0.041 ms
Execution Time: 0.155 ms