Re: Redundant Result node
Richard Guo <guofenglinux@gmail.com>
From: Richard Guo <guofenglinux@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-08-27T03:29:52Z
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 →
-
Avoid unnecessary post-sort projection
- 9626068f1333 18.0 landed
Attachments
- v2-0001-Avoid-unnecessary-post-sort-projection.patch (application/octet-stream) patch v2-0001
On Mon, Aug 26, 2024 at 8:58 PM Peter Eisentraut <peter@eisentraut.org> wrote: > On 23.08.24 10:27, Richard Guo wrote: > > Fair point. After looking at the code for a while, I believe it is > > sufficient to compare PathTarget.exprs after we've checked that the > > two targets have different pointers. > > - if (sorted_path->pathtarget != target) > + if (sorted_path->pathtarget != target && > + !equal(sorted_path->pathtarget->exprs, target->exprs)) > sorted_path = apply_projection_to_path(root, ordered_rel, > > equal() already checks whether both pointers are equal, so I think this > could be simplified to just > > if (!equal(sorted_path->pathtarget->exprs, target->exprs)) Indeed. If the target pointers are equal, the PathTarget.exprs pointers must be equal too. Attached is the updated patch with this change. Thanks Richard