From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: Evaluate arguments of correlated SubPlans in the referencing ExprState |
Date: | 2024-08-01 02:12:37 |
Message-ID: | 20240801021237.s4gdnxyrxvbbi77m@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2023-02-25 13:44:01 -0800, Andres Freund wrote:
> Ended up simpler than I'd thought. I see small, consistent, speedups and
> reductions in memory usage.
For the sake of person following the link from the commit message to this
thread in a few years, I thought it'd be useful to have an example for the
differences due to the patch.
Consider e.g. the query used for psql's \d pg_class, just because that's the
first thing using a subplan that I got my hand on:
Memory usage in ExecutorState changes from
Grand total: 131072 bytes in 12 blocks; 88696 free (2 chunks); 42376 used
to
Grand total: 131072 bytes in 12 blocks; 93656 free (4 chunks); 37416 used
What's more interesting is that if I - just to show the effect - force JITing,
EXPLAIN ANALYZE's jit section changes from:
JIT:
Functions: 31
Options: Inlining true, Optimization true, Expressions true, Deforming true
Timing: Generation 2.656 ms (Deform 1.496 ms), Inlining 25.147 ms, Optimization 112.853 ms, Emission 81.585 ms, Total 222.241 ms
to
JIT:
Functions: 21
Options: Inlining true, Optimization true, Expressions true, Deforming true
Timing: Generation 1.883 ms (Deform 0.990 ms), Inlining 23.821 ms, Optimization 85.150 ms, Emission 64.303 ms, Total 175.157 ms
I.e. noticeably reduced overhead, mostly due to the reduction in emitted
functions.
The difference obviously gets bigger the more parameters the subplan has, in
artificial cases it can be very large.
I also see some small performance gains during execution, but for realistic
queries that's in the ~1-3% range.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Lakhin | 2024-08-01 03:00:00 | v17 vs v16 performance comparison |
Previous Message | David Rowley | 2024-08-01 02:01:07 | Re: On disable_cost |