Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 2D97E2E2EA9 for ; Wed, 12 Mar 2008 14:22:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 74647-01-9 for ; Wed, 12 Mar 2008 14:22:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 92C4C2E0269 for ; Wed, 12 Mar 2008 14:22:18 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m2CHME0k023604; Wed, 12 Mar 2008 13:22:14 -0400 (EDT) To: "Pavan Deolasee" cc: "Heikki Linnakangas" , "Craig Ringer" , pgsql-patches Subject: Re: [PERFORM] Very slow (2 tuples/second) sequential scan after bulk insert; speed returns to ~500 tuples/second after commit In-reply-to: <2e78013d0803121002o2b7a8531y1553ce66cb6d1537@mail.gmail.com> References: <47D505AF.4040101@postnewspapers.com.au> <23588.1205159638@sss.pgh.pa.us> <47D54A47.3030608@postnewspapers.com.au> <47D54DB2.4020405@enterprisedb.com> <24304.1205162440@sss.pgh.pa.us> <47D67C3F.1030406@enterprisedb.com> <5827.1205269597@sss.pgh.pa.us> <47D7DE12.80700@enterprisedb.com> <2e78013d0803120847k2e8afbedrc39e29e5194d3c6e@mail.gmail.com> <19902.1205337439@sss.pgh.pa.us> <2e78013d0803121002o2b7a8531y1553ce66cb6d1537@mail.gmail.com> Comments: In-reply-to "Pavan Deolasee" message dated "Wed, 12 Mar 2008 22:32:37 +0530" Date: Wed, 12 Mar 2008 13:22:13 -0400 Message-ID: <23603.1205342533@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/194 X-Sequence-Number: 5257 "Pavan Deolasee" writes: > On Wed, Mar 12, 2008 at 9:27 PM, Tom Lane wrote: >> and it would have problems with a slow transaction >> generating a sparse set of subtransaction XIDs. > I agree thats the worst case. But is that common ? Thats what I > was thinking when I proposed the alternate solution. I thought that can > happen only if most of the subtransactions abort, which again I thought > is not a normal case. No, I was thinking of the case where other sessions are chewing up XIDs while the lots-of-subtransactions transaction runs. If it's slow enough, there could be very large gaps between the XIDs it acquires for its subtransactions. So you'd have a situation where the exact same transaction processing might or might not run out of memory depending on what else happened meanwhile. Not a very pleasant property. regards, tom lane