pgsql: Optimize xid/subxid searches in XidInMVCCSnapshot(). - Mailing list pgsql-committers

From John Naylor
Subject pgsql: Optimize xid/subxid searches in XidInMVCCSnapshot().
Date
Msg-id E1oLyGE-000DPC-W5@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Optimize xid/subxid searches in XidInMVCCSnapshot().

As reported by Yura Sokolov, scanning the snapshot->xip array has
noticeable impact on scalability when there are a large number of
concurrent writers. Use the optimized (on x86-64) routine from b6ef16756
to speed up searches through the [sub]xip arrays. One benchmark showed
a 5% increase in transaction throughput with 128 concurrent writers,
and a 50% increase in a pathological case of 1024 writers. While a hash
table would have scaled even better, it was ultimately rejected because
of concerns around code complexity and memory allocation. Credit to Andres
Freund for the idea to optimize linear search using SIMD instructions.

Nathan Bossart

Reviewed by: Andres Freund, John Naylor, Bharath Rupireddy, Masahiko Sawada
Discussion: https://postgr.es/m/20220713170950.GA3116318%40nathanxps13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/37a6e5df3713498a21942dae2ed3122bba5b9f50

Modified Files
--------------
src/backend/utils/time/snapmgr.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)


pgsql-committers by date:

Previous
From: Robert Haas
Date:
Subject: pgsql: Move basebackup code to new directory src/backend/backup
Next
From: Amit Kapila
Date:
Subject: pgsql: Fix catalog lookup with the wrong snapshot during logical decodi