| From: | Rahila Syed <rahilasyed90(at)gmail(dot)com> |
|---|---|
| To: | Jingtang Zhang <mrdrivingduck(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de> |
| Cc: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, pgsql-hackers mailing list <pgsql-hackers(at)lists(dot)postgresql(dot)org>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Subject: | Re: Stale hash entries when reusing an auxiliary resource owner |
| Date: | 2026-11-04 08:43:25 |
| Message-ID: | CAH2L28ty8HkS5fpiVe58yUOHsV_vftbV8zzhvZ5k0t=jhUeSYg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
> > The fast-path is the !hash case, I don't think any realistic workload would
> > notice the overhead of zeroing out hash table entries during the compaction in
> > ResourceOwnerSort()? I don't know if we'd need to do anything else?
>
> For now, the latter seems more reasonable to me, since Reset is
> specifically responsible for preparing a released owner for reuse.
> Clearing the retained hash table fits that responsibility. Also, Reset
> would currently only be used for the auxiliary owner, whose cleanup
> seems less performance-critical than the general ResourceOwner release
> path.
>
> I'm not sure which is better overall, so I have prepared patches
> for both approaches.
My two cents:
It will be interesting to benchmark the overhead of clearing these entries
during ResourceOwnerSort and ResourceOwnerRelease.
Assuming no significant performance impact, I think it makes more
sense to reset the entries where they are being compacted out or
released instead of introducing a new API
function for the same. It also guarantees that entries are cleared
even if an error occurs before they are reset.
I am planning to review the patches in detail.
FWIW, unrelated but improving the same API, [1] makes it easier for
non-transaction resource
owners like the AuxProcessResourceOwner to release resources by
allowing them to release all the resources at
once instead of calling ResourceOwnerRelease three times for each phase.
Views are welcome.
Thank you,
Rahila Syed
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayoub Kazar | 2026-11-04 08:57:56 | Re: Fix DEFAULT marker handling in COPY FROM ... HEADER MATCH |
| Previous Message | Pavel Stehule | 2026-11-04 08:42:22 | possible bug - xmlconcat is badly marked as immutable |