Re: Bulk Inserts

From: Pierre Frédéric Caillaud <lists(at)peufeu(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Cc: "Jeff Janes" <jeff(dot)janes(at)gmail(dot)com>
Subject: Re: Bulk Inserts
Date: 2009-09-14 19:25:41
Message-ID: op.uz9hk3hqcke6l8@soyouz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Replying to myself...

Jeff suggested to build pages in local memory and insert them later in the
table. This is what's used in CLUSTER for instance, I believe.

It has some drawbacks though :

- To insert the tuples in indexes, the tuples need tids, but if you build
the page in local memory, you don't know on which page they will be until
after allocating the page, which will probably be done after the page is
built, so it's a bit of a chicken and egg problem.

- It only works on new pages. Pages which are not empty, but have free
space, cannot be written in this way.

The little experiment I made yesterday does not have these drawbacks,
since it allocates pages in the standard way, simply it inserts many
tuples in one operation instead of just inserting one. If the page
happened to be empty, it's even better, but it's not necessary. If your
table has lots of free space, it will be used.

In response to

  • Bulk Inserts at 2009-09-14 14:26:53 from Pierre Frédéric Caillaud

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2009-09-14 19:30:39 Re: [PATCH] DefaultACLs
Previous Message Emmanuel Cecchet 2009-09-14 19:25:29 Re: generic copy options