pgsql: Fix unexpected reversal of lists during catcache rehash

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix unexpected reversal of lists during catcache rehash
Date: 2026-01-07 08:53:17
Message-ID: E1vdPI4-0054B5-12@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix unexpected reversal of lists during catcache rehash

During catcache searches, the most-recently searched entries are kept at
the head of the list to speed up subsequent searches, keeping the
"freshest" entries at its beginning. A rehash of the catcache was doing
the opposite: fresh entries were moved to the tail of the newly-created
buckets, causing a rehash to slow down a bit.

When a rehash is done, this commit switches the code to use
dlist_push_tail() instead of dlist_push_head(), so as fresh entries are
kept at the head of the lists, not their tail.

Author: ChangAo Chen <cca5507(at)qq(dot)com>
Reviewed-by: John Naylor <johncnaylorls(at)gmail(dot)com>
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz>
Discussion: https://postgr.es/m/tencent_9EA10D8512B5FE29E7323F780A0749768708@qq.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/68119480a763d761a9cf2413f4320d9a5d4b34d5

Modified Files
--------------
src/backend/utils/cache/catcache.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jakub Wartak 2026-01-07 09:01:48 Re: failed NUMA pages inquiry status: Operation not permitted
Previous Message Michael Paquier 2026-01-07 05:14:43 pgsql: Fix grammar in datatype.sgml