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

From Dmitry Dolgov
Subject Re: [RFC] Add jit deform_counter
Date
Msg-id 20230108105601.zhgxms5kighuptbw@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 Sat, Jan 07, 2023 at 07:09:11PM +0100, Pavel Stehule wrote:
> so 7. 1. 2023 v 16:48 odesílatel Dmitry Dolgov <9erthalion6@gmail.com>
> napsal:
>
> > > On Fri, Jan 06, 2023 at 09:42:09AM +0100, Pavel Stehule wrote:
> > > The explain part is working, the part of pg_stat_statements doesn't
> > >
> > > set jit_above_cost to 10;
> > > set jit_optimize_above_cost to 10;
> > > set jit_inline_above_cost to 10;
> > >
> > > (2023-01-06 09:08:59) postgres=# explain analyze select
> > > count(length(prosrc) > 0) from pg_proc;
> > >
> >
┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
> > > │                                                             QUERY PLAN
> > >                                                           │
> > >
> >
╞════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════╡
> > > │ Aggregate  (cost=154.10..154.11 rows=1 width=8) (actual
> > > time=132.320..132.321 rows=1 loops=1)
> >   │
> > > │   ->  Seq Scan on pg_proc  (cost=0.00..129.63 rows=3263 width=16)
> > (actual
> > > time=0.013..0.301 rows=3266 loops=1)                     │
> > > │ Planning Time: 0.070 ms
> > >                                                          │
> > > │ JIT:
> > >                                                           │
> > > │   Functions: 3
> > >                                                           │
> > > │   Options: Inlining true, Optimization true, Expressions true,
> > Deforming
> > > true                                                      │
> > > │   Timing: Generation 0.597 ms, Deforming 0.407 ms, Inlining 8.943 ms,
> > > Optimization 79.403 ms, Emission 43.091 ms, Total 132.034 ms │
> > > │ Execution Time: 132.986 ms
> > >                                                           │
> > >
> >
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
> > > (8 rows)
> > >
> > > I see the result of deforming in explain analyze, but related values in
> > > pg_stat_statements are 0.
> >
> > I'm not sure why, but pgss jit metrics are always nulls for explain
> > analyze queries. I have noticed this with surprise myself, when recently
> > was reviewing the lazy jit patch, but haven't yet figure out what is the
> > reason. Anyway, without "explain analyze" you'll get correct deforming
> > numbers in pgss.
> >
>
> It was really strange, because I tested the queries without EXPLAIN ANALYZE
> too, and new columns were always zero on my comp. Other jit columns were
> filled.  But I didn't do a deeper investigation.

Interesting. I've verified it once more with the query and the
parameters you've posted, got the following:

    jit_functions          | 3
    jit_generation_time    | 1.257522
    jit_deform_count       | 1
    jit_deform_time        | 10.381345
    jit_inlining_count     | 1
    jit_inlining_time      | 71.628168
    jit_optimization_count | 1
    jit_optimization_time  | 48.146447
    jit_emission_count     | 1
    jit_emission_time      | 0.737822

Maybe there is anything else special about how you run it?

Otherwise addressed the rest of commentaries, thanks.

Attachment

pgsql-hackers by date:

Previous
From: Ankit Kumar Pandey
Date:
Subject: Re: Todo: Teach planner to evaluate multiple windows in the optimal order
Next
From: Pavel Stehule
Date:
Subject: Re: [RFC] Add jit deform_counter