Re: [RFC] Add jit deform_counter

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Ian Lawrence Barwick <barwick(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [RFC] Add jit deform_counter
Date: 2023-01-08 10:56:01
Message-ID: 20230108105601.zhgxms5kighuptbw@erthalion.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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 Content-Type Size
v3-0001-Add-deform_counter.patch text/x-diff 4.6 KB
v3-0002-Add-deform_counter-to-pg_stat_statements.patch text/x-diff 9.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2023-01-08 11:00:12 Re: [RFC] Add jit deform_counter
Previous Message Ankit Kumar Pandey 2023-01-08 10:21:35 Re: Todo: Teach planner to evaluate multiple windows in the optimal order