Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T3ahc-0001Ad-1Y for pgsql-hackers@postgresql.org; Mon, 20 Aug 2012 22:44:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T3ahZ-00043b-KJ for pgsql-hackers@postgresql.org; Mon, 20 Aug 2012 22:44:07 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q7KMi1lR011361; Mon, 20 Aug 2012 18:44:01 -0400 (EDT) From: Tom Lane To: Robert Haas cc: Bruce Momjian , Florian Weimer , pgsql-hackers@postgresql.org Subject: Re: Large number of open(2) calls with bulk INSERT into empty table In-reply-to: References: <82ipm51tcd.fsf@mid.bfk.de> <827h29q4pd.fsf@mid.bfk.de> <20120817010524.GL30286@momjian.us> <8708.1345494466@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 20 Aug 2012 16:47:40 -0400" Date: Mon, 20 Aug 2012 18:44:01 -0400 Message-ID: <11360.1345502641@sss.pgh.pa.us> X-Pg-Spam-Score: -2.1 (--) X-Archive-Number: 201208/578 X-Sequence-Number: 212399 Robert Haas writes: > On Mon, Aug 20, 2012 at 4:27 PM, Tom Lane wrote: >> Surely we could just prevent creation of the FSM until the table has >> reached at least, say, 10 blocks. >> >> Any threshold beyond one block would mean potential space wastage, >> but it's hard to get excited about that until you're into the dozens >> of pages. > I dunno, I think one-row tables are pretty common. Sure, and for that you don't need an FSM, because any row allocation attempt will default to trying the last existing block before it extends (see RelationGetBufferForTuple). It's only once you've got more than one block in the table that it becomes interesting. If we had a convention that FSM is only created for rels of more than N blocks, perhaps it'd be worthwhile to teach RelationGetBufferForTuple to try all existing blocks when relation size <= N. Or equivalently, hack the FSM code to return all N pages when it has no info. regards, tom lane