Re: Large number of open(2) calls with bulk INSERT into empty table

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Florian Weimer <fweimer(at)bfk(dot)de>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Large number of open(2) calls with bulk INSERT into empty table
Date: 2012-08-23 19:19:36
Message-ID: 20120823191936.GB5971@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 21, 2012 at 09:52:02AM -0400, Robert Haas wrote:
> On Mon, Aug 20, 2012 at 6:44 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> >> On Mon, Aug 20, 2012 at 4:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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.
>
> Now that's an idea I could get behind. I'd pick a smaller value of N
> than what you suggested (10), perhaps 5. But I like it otherwise.

TODO added:

Avoid creation of the free space map for small tables

http://archives.postgresql.org/pgsql-hackers/2011-11/msg01751.php
http://archives.postgresql.org/pgsql-hackers/2012-08/msg00552.php

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-08-23 19:21:25 Re: TODO
Previous Message Alvaro Herrera 2012-08-23 19:00:12 Re: size of .po changesets