| From: | Tender Wang <tndrwang(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Self-join elimination discards differing row lock wait policies |
| Date: | 2026-10-26 09:05:03 |
| Message-ID: | CAHewXN=ofNonQSvzJ5a0csWtFJ=N5SAY_nJGPuNhkgKCs8svSg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 于2026年10月26日周一 11:29写道:
>
> Agreed that there's separable issues there. Since you seem to be
> interested in pursuing this, I attach the patch I had as far as
> I'd taken it (I stopped upon realizing that preprocess_rowmarks
> prevents a lot of the new code from being reached). You could
> compare this to yours, which I've not looked at, and take the better
> bits from each.
Thanks for sharing your WIP patch.
After comparing it with mine, I confirmed your observation that
preprocess_rowmarks() makes the cases where only one SJE candidate has
a PlanRowMark unreachable.
When row marks are needed, every non-target base relation receives
one, and target relations are not SJE candidates.
Thus, the two candidate relations must either both have row marks, or
both lack them.
The attached v3 is now a two-patch series:
0001 documents this invariant, adds assertions for it, and removes
unreachable code that transfers an rmark when there is no kmark.
0002 is based on your WIP patch. It allows SJE for locking row marks
of different strengths, while removing the unreachable single-rowmark
handling.
It retains the stronger lock and its associated waitPolicy; for equal
lock strengths, it takes the greater waitPolicy, as
applyLockingClause() does.
--
Thanks,
Tender Wang
| Attachment | Content-Type | Size |
|---|---|---|
| v3-0001-Clarify-row-mark-handling-in-self-join-eliminatio.patch | text/plain | 3.3 KB |
| v3-0002-Allow-self-join-elimination-with-different-row-lo.patch | text/plain | 6.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Previous Message | Jeevan Chalke | 2026-10-26 08:58:17 | PL/pgSQL: allow parallel query for assignment statements |