Evaluate arguments of correlated SubPlans in the referencing ExprState
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@postgresql.org
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2023-02-25T21:44:01Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Evaluate arguments of correlated SubPlans in the referencing ExprState
- a7f107df2b70 18.0 landed
-
Doc: improve documentation for jsonpath behavior.
- 7014c9a4bba2 17.0 cited
Attachments
Hi, Around https://www.postgresql.org/message-id/20230224015417.75yimxbksejpffh3%40awork3.anarazel.de I suggested that we should evaluate the arguments of correlated SubPlans as part of the expression referencing the subplan. Here's a patch for that. Ended up simpler than I'd thought. I see small, consistent, speedups and reductions in memory usage. I think individual arguments are mainly (always?) Var nodes. By evaluating them as part of the containing expression we avoid the increased memory usage, and the increased dispatch of going through another layer of ExprState. Because the arguments are a single Var, which end up with a slot_getattr() via ExecJust*Var, we also elide redundant slot_getattr() checks. I think we already avoided redundant tuple deforming, because the parent ExprState will have done that already. Greetings, Andres Freund