Re: HOT is applied - Mailing list pgsql-hackers

From Tom Lane
Subject Re: HOT is applied
Date
Msg-id 5424.1190388137@sss.pgh.pa.us
Whole thread Raw
In response to Re: HOT is applied  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Responses Re: HOT is applied
Re: HOT is applied
List pgsql-hackers
"Heikki Linnakangas" <heikki@enterprisedb.com> writes:
> If you look at the callgraph, you'll see that those
> LWLockAcquire/Release calls are coming from HeapTupleSatisfiesVacuum ->
> TransactionIdIsInProgress, which keeps trashing the ProcArrayLock. A
> "if(TransactionIdIsCurrentTransactionId(xid)) return true;" check in
> TransactionIdIsInProgress would speed that up, but I wonder if there's a
> more general solution to make HeapTupleSatisfiesVacuum cheaper. For
> example, we could cache the in-progress status of tuples.

Dunno about "more general", but your idea reduces the runtime of this
example by about 50% (22.2s to 10.5s) for me.  I'm worried though that
it would be a net negative in more typical situations, especially if
you've got a lot of open subtransactions.
        regards, tom lane

*** src/backend/storage/ipc/procarray.c.orig    Sat Sep  8 16:31:15 2007
--- src/backend/storage/ipc/procarray.c    Fri Sep 21 11:08:34 2007
***************
*** 341,346 ****
--- 341,353 ----         return false;     } 
+     /*
+      * Also, we can detect our own transaction without any access to shared
+      * memory.
+      */
+     if (TransactionIdIsCurrentTransactionId(xid))
+         return true;
+      /* Get workspace to remember main XIDs in */     xids = (TransactionId *) palloc(sizeof(TransactionId) *
arrayP->maxProcs);
 


pgsql-hackers by date:

Previous
From: "Heikki Linnakangas"
Date:
Subject: Re: HOT is applied
Next
From: Tom Lane
Date:
Subject: Re: Schema access in PL/PGSQL for custom objects - i.e. type access?