"Heikki Linnakangas" <[EMAIL PROTECTED]> 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);
  

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to