Re: [RFC] Add jit deform_counter - Mailing list pgsql-hackers

From Dmitry Dolgov
Subject Re: [RFC] Add jit deform_counter
Date
Msg-id 20230115135737.pkmf3zunh54bz5oh@erthalion.local
Whole thread Raw
In response to Re: [RFC] Add jit deform_counter  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: [RFC] Add jit deform_counter
List pgsql-hackers
> On Sun, Jan 08, 2023 at 09:06:33PM +0100, Pavel Stehule wrote:
> It is working although I am not sure if it is correctly
>
> when I run EXPLAIN ANALYZE for query `explain analyze select
> count(length(prosrc) > 0) from pg_proc;`
>
> I got plan and times
>
>
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
> │                                                             QUERY PLAN
>                                                            │
>
╞═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
> │ Aggregate  (cost=154.10..154.11 rows=1 width=8) (actual
> time=134.450..134.451 rows=1 loops=1)
> │
> │   ->  Seq Scan on pg_proc  (cost=0.00..129.63 rows=3263 width=16) (actual
> time=0.013..0.287 rows=3266 loops=1)                      │
> │ Planning Time: 0.088 ms
>                                                           │
> │ JIT:
>                                                            │
> │   Functions: 3
>                                                            │
> │   Options: Inlining true, Optimization true, Expressions true, Deforming
> true                                                       │
> │   Timing: Generation 0.631 ms, Deforming 0.396 ms, Inlining 10.026 ms,
> Optimization 78.608 ms, Emission 44.915 ms, Total 134.181 ms │
> │ Execution Time: 135.173 ms
>                                                            │
>
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
> (8 rows)
>
>  Deforming is 0.396ms
>
> When I run mentioned query, and when I look to pg_stat_statements table, I
> see different times
>
> deforming is about 10ms
>
> wal_bytes              │ 0
> jit_functions          │ 9
> jit_generation_time    │ 1.9040409999999999
> jit_deform_count       │ 3
> jit_deform_time        │ 36.395131
> jit_inlining_count     │ 3
> jit_inlining_time      │ 256.104205
> jit_optimization_count │ 3
> jit_optimization_time  │ 132.45361300000002
> jit_emission_count     │ 3
> jit_emission_time      │ 1.210633
>
> counts are correct, but times are strange -  there is not consistency with
> values from EXPLAIN
>
> When I run this query on master, the values are correct
>
>  jit_functions          │ 6
>  jit_generation_time    │ 1.350521
>  jit_inlining_count     │ 2
>  jit_inlining_time      │ 24.018382000000003
>  jit_optimization_count │ 2
>  jit_optimization_time  │ 173.405792
>  jit_emission_count     │ 2
>  jit_emission_time      │ 91.226655
> ────────────────────────┴───────────────────
>
> │ JIT:
>                                       │
> │   Functions: 3
>                                       │
> │   Options: Inlining true, Optimization true, Expressions true, Deforming
> true                                  │
> │   Timing: Generation 0.636 ms, Inlining 9.309 ms, Optimization 89.653 ms,
> Emission 45.812 ms, Total 145.410 ms │
> │ Execution Time: 146.410 ms
>                                       │
> └────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Thanks for noticing. Similarly to the previous issue, the order of
columns was incorrect -- deform counters have to be the last columns in
the view.

Attachment

pgsql-hackers by date:

Previous
From: "Karl O. Pinc"
Date:
Subject: Re: Doc: Rework contrib appendix -- informative titles, tweaked sentences
Next
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: logrep stuck with 'ERROR: int2vector has too many elements'