X-Original-To: pgsql-hackers-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 5CAEA9FB1BC for ; Thu, 14 Sep 2006 11:44:21 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 60455-03 for ; Thu, 14 Sep 2006 11:44:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E93599FA0FC for ; Thu, 14 Sep 2006 11:44:10 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k8EEhJmX029129; Thu, 14 Sep 2006 10:43:19 -0400 (EDT) To: Alvaro Herrera cc: Gregory Stark , ITAGAKI Takahiro , Bruce Momjian , pgsql-hackers@postgresql.org Subject: Re: CSStorm occurred again by postgreSQL8.2 In-reply-to: <20060914142222.GA525@alvh.no-ip.org> References: <20060808110913.50FA.ITAGAKI.TAKAHIRO@oss.ntt.co.jp> <200608260346.k7Q3k2g06954@momjian.us> <20060828181312.5638.ITAGAKI.TAKAHIRO@oss.ntt.co.jp> <13251.1157299738@sss.pgh.pa.us> <22080.1158198335@sss.pgh.pa.us> <87mz92so6n.fsf@enterprisedb.com> <27509.1158237711@sss.pgh.pa.us> <28167.1158241250@sss.pgh.pa.us> <28515.1158242279@sss.pgh.pa.us> <20060914142222.GA525@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Thu, 14 Sep 2006 10:22:22 -0400" Date: Thu, 14 Sep 2006 10:43:19 -0400 Message-ID: <29128.1158244999@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.107 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/1109 X-Sequence-Number: 90638 Alvaro Herrera writes: > Tom Lane wrote: >> I think Theo's problem is probably somewhere else, too --- apparently >> it's not so much that TransactionIdIsCurrentTransactionId takes a long >> time as that something is calling it lots of times with no check for >> interrupt. > Could it be something like heap_lock_tuple? It calls MultiXactIdWait, > which calls GetMultXactIdMembers and TransactionIdIsCurrentTransactionId > on each member. (heap_update and heap_delete do the same thing). I > must admit I didn't read Theo's description on his scenario though. He shows HeapTupleSatisfiesSnapshot as the next thing down the call stack, so those scenarios don't seem quite right. I'm wondering about a CHECK_FOR_INTERRUPTS-free loop in either plperl or trigger handling, myself. Anyway, I was thinking some more about Theo's original suggestion that the linked-list representation of childXids was too inefficient. I'm disinclined to use a hash as he suggests, but it strikes me that we could very easily change the list into a dynamically extended array --- and because the entries are surely added in increasing XID order, such an array could be binary-searched. This wouldn't be a win for very small numbers of child XIDs, but for large numbers it would. OTOH, there are probably enough other inefficiencies in handling large numbers of subxact XIDs that speeding up TransactionIdIsCurrentTransactionId might be a useless exercise. It would be good to profile a test case before spending much effort here. regards, tom lane