From a615acf555c0e9ea6ed1c5398d14b81ff2179e6c Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 6 Dec 2005 18:10:06 +0000 Subject: Arrange for read-only accesses to SLRU page buffers to take only a shared lock, not exclusive, if the desired page is already in memory. This can be demonstrated to be a significant win on the pg_subtrans cache when there is a large window of open transactions. It should be useful for pg_clog as well. I didn't try to make GetMultiXactIdMembers() use the code, as that would have taken some restructuring, and what with the local cache for multixact contents it probably wouldn't really make a difference. Per my recent proposal. --- src/backend/access/transam/clog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/access/transam/clog.c') diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c index 44e1b9b7d3b..22e2c0541e1 100644 --- a/src/backend/access/transam/clog.c +++ b/src/backend/access/transam/clog.c @@ -24,7 +24,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.34 2005/11/05 21:19:47 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/clog.c,v 1.35 2005/12/06 18:10:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -128,9 +128,9 @@ TransactionIdGetStatus(TransactionId xid) char *byteptr; XidStatus status; - LWLockAcquire(CLogControlLock, LW_EXCLUSIVE); + /* lock is acquired by SimpleLruReadPage_ReadOnly */ - slotno = SimpleLruReadPage(ClogCtl, pageno, xid); + slotno = SimpleLruReadPage_ReadOnly(ClogCtl, pageno, xid); byteptr = ClogCtl->shared->page_buffer[slotno] + byteno; status = (*byteptr >> bshift) & CLOG_XACT_BITMASK; -- cgit v1.2.3