Re: [RFC] Add jit deform_counter

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Dmitry Dolgov <9erthalion6(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 20:06:33
Message-ID: CAFj8pRD44r8-6C9HQDuDSkNGw49pseh8RvT_8G+8OQN7xGoYAw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

> > 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 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

└────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Regards

Pavel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Isaac Morland 2023-01-08 20:09:36 Re: MERGE ... RETURNING
Previous Message Alexander Korotkov 2023-01-08 19:53:00 Re: Fix gin index cost estimation