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-15 13:57:37
Message-ID: 20230115135737.pkmf3zunh54bz5oh@erthalion.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v4-0001-Add-deform_counter.patch text/x-diff 4.6 KB
v4-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 houzj.fnst@fujitsu.com 2023-01-15 14:46:42 RE: logrep stuck with 'ERROR: int2vector has too many elements'
Previous Message Karl O. Pinc 2023-01-15 13:35:21 Re: Doc: Rework contrib appendix -- informative titles, tweaked sentences