Re: Bulk Inserts - Mailing list pgsql-hackers

From Pierre Frédéric Caillaud
Subject Re: Bulk Inserts
Date
Msg-id op.uz9hk3hqcke6l8@soyouz
Whole thread Raw
In response to Bulk Inserts  (Pierre Frédéric Caillaud<lists@peufeu.com>)
Responses Re: Bulk Inserts
List 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.


pgsql-hackers by date:

Previous
From: Andrew Chernow
Date:
Subject: Re: new version of PQconnectdb was:(Re: [HACKERS] Determining client_encoding from client locale)
Next
From: Emmanuel Cecchet
Date:
Subject: Re: generic copy options