jit_explain.out

application/octet-stream

Filename: jit_explain.out
Type: application/octet-stream
Part: 1
Message: Re: Query is over 2x slower with jit=on
postgres=# set max_parallel_workers_per_gather=4;

postgres=# explain analyze verbose
  select count(*) from tenk1 a where (unique1, two) in
    (select unique1, row_number() over() from tenk1 b);

                                                                            QUERY PLAN                                                                            
------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Aggregate  (cost=18656.00..18656.01 rows=1 width=8) (actual time=593.917..593.917 rows=1 loops=1)
   Output: count(*)
   ->  Hash Join  (cost=10718.00..18456.00 rows=80000 width=0) (actual time=496.650..593.883 rows=16 loops=1)
         Inner Unique: true
         Hash Cond: ((a.unique1 = b.unique1) AND (a.two = (row_number() OVER (?))))
         ->  Gather  (cost=0.00..5918.00 rows=160000 width=8) (actual time=192.319..223.384 rows=160000 loops=1)
               Output: a.unique1, a.two
               Workers Planned: 4
               Workers Launched: 4
               Jit for Worker : 0
                 Functions: 2
                 Generation Time: 0.273 ms
                 Inlining: true
                 Inlining Time: 43.686 ms
                 Optimization: true
                 Optimization Time: 10.788 ms
                 Emission Time: 8.438 ms
               Jit for Worker : 1
                 Functions: 2
                 Generation Time: 0.293 ms
                 Inlining: true
                 Inlining Time: 72.587 ms
                 Optimization: true
                 Optimization Time: 10.386 ms
                 Emission Time: 8.115 ms
               Jit for Worker : 2
                 Functions: 2
                 Generation Time: 0.299 ms
                 Inlining: true
                 Inlining Time: 60.683 ms
                 Optimization: true
                 Optimization Time: 17.454 ms
                 Emission Time: 14.073 ms
               Jit for Worker : 3
                 Functions: 2
                 Generation Time: 0.276 ms
                 Inlining: true
                 Inlining Time: 53.904 ms
                 Optimization: true
                 Optimization Time: 10.497 ms
                 Emission Time: 8.402 ms
               ->  Parallel Seq Scan on public.tenk1 a  (cost=0.00..5918.00 rows=40000 width=8) (actual time=102.228..111.833 rows=32000 loops=5)
                     Output: a.unique1, a.two
                     Worker 0: actual time=63.059..78.865 rows=44573 loops=1
                     Worker 1: actual time=91.236..101.269 rows=36750 loops=1
                     Worker 2: actual time=92.371..103.505 rows=38657 loops=1
                     Worker 3: actual time=72.968..84.006 rows=39991 loops=1
         ->  Hash  (cost=10478.00..10478.00 rows=16000 width=12) (actual time=301.049..301.049 rows=160000 loops=1)
               Output: b.unique1, (row_number() OVER (?))
               Buckets: 131072 (originally 16384)  Batches: 4 (originally 1)  Memory Usage: 3073kB
               ->  HashAggregate  (cost=10318.00..10478.00 rows=16000 width=12) (actual time=197.525..252.847 rows=160000 loops=1)
                     Output: b.unique1, (row_number() OVER (?))
                     Group Key: b.unique1, row_number() OVER (?)
                     ->  WindowAgg  (cost=0.00..7918.00 rows=160000 width=12) (actual time=0.737..112.403 rows=160000 loops=1)
                           Output: b.unique1, row_number() OVER (?)
                           ->  Gather  (cost=0.00..5918.00 rows=160000 width=4) (actual time=0.727..46.096 rows=160000 loops=1)
                                 Output: b.unique1
                                 Workers Planned: 4
                                 Workers Launched: 3
                                 Jit for Worker : 0
                                   Functions: 2
                                   Generation Time: 0.161 ms
                                   Inlining: true
                                   Inlining Time: 50.254 ms
                                   Optimization: true
                                   Optimization Time: 9.510 ms
                                   Emission Time: 4.859 ms
                                 Jit for Worker : 1
                                   Functions: 2
                                   Generation Time: 0.251 ms
                                   Inlining: true
                                   Inlining Time: 50.094 ms
                                   Optimization: true
                                   Optimization Time: 8.776 ms
                                   Emission Time: 4.162 ms
                                 Jit for Worker : 2
                                   Functions: 2
                                   Generation Time: 0.153 ms
                                   Inlining: true
                                   Inlining Time: 29.091 ms
                                   Optimization: true
                                   Optimization Time: 5.649 ms
                                   Emission Time: 3.163 ms
                                 ->  Parallel Seq Scan on public.tenk1 b  (cost=0.00..5918.00 rows=40000 width=4) (actual time=41.503..52.883 rows=40000 loops=4)
                                       Output: b.unique1
                                       Worker 0: actual time=64.812..65.809 rows=1653 loops=1
                                       Worker 1: actual time=63.147..64.065 rows=1653 loops=1
                                       Worker 2: actual time=38.028..72.399 rows=119719 loops=1
 Planning Time: 0.548 ms
 Jit: 
   Functions: 40
   Generation Time: 3.892 ms
   Inlining: true
   Inlining Time: 409.397 ms
   Optimization: true
   Optimization Time: 174.708 ms
   Emission Time: 91.785 ms
 Execution Time: 610.262 ms
(98 rows)