Re: [HACKERS] Bulk Inserts

2009-09-17 Thread Jeff Janes
2009/9/16 Pierre Frédéric Caillaud li...@peufeu.com OK, that makes sense. I thought you had hacked either XLogInsert or the heap WAL replay code so that you could just accumulate tuples in the rdata chain and then submit them all under the cover of a single WALInsertLock. Ah, no, I did

Re: [HACKERS] Bulk Inserts

2009-09-16 Thread Pierre Frédéric Caillau d
OK, that makes sense. I thought you had hacked either XLogInsert or the heap WAL replay code so that you could just accumulate tuples in the rdata chain and then submit them all under the cover of a single WALInsertLock. Ah, no, I did not do that. This would be difficult to do : rdata

Re: [HACKERS] Bulk Inserts

2009-09-15 Thread Pierre Frédéric Caillau d
Yes, I did not consider that to be a problem because I did not think it would be used on indexed tables. I figured that the gain from doing bulk inserts into the table would be so diluted by the still-bottle-necked index maintenance that it was OK not to use this optimization for indexed

Re: [HACKERS] Bulk Inserts

2009-09-15 Thread Pierre Frédéric Caillau d
Does that heuristic change the timings much? If not, it seems like it would better to keep it simple and always do the same thing, like log the tuples (if it is done under one WALInsertLock, which I am assuming it is..) It is the logging of whole pages that makes it faster. If you fill a

Re: [HACKERS] Bulk Inserts

2009-09-15 Thread Jeff Janes
2009/9/15 Pierre Frédéric Caillaud li...@peufeu.com Does that heuristic change the timings much? If not, it seems like it would better to keep it simple and always do the same thing, like log the tuples (if it is done under one WALInsertLock, which I am assuming it is..) It is the logging

[HACKERS] Bulk Inserts

2009-09-14 Thread Pierre Frédéric Caillau d
I've done a little experiment with bulk inserts. = heap_bulk_insert() Behaves like heap_insert except it takes an array of tuples (HeapTuple *tups, int ntups). - Grabs a page (same as heap_insert) - While holding exclusive lock, inserts as many tuples as it can on the page. -

Re: [HACKERS] Bulk Inserts

2009-09-14 Thread Pierre Frédéric Caillau d
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

Re: [HACKERS] Bulk Inserts

2009-09-14 Thread Jeff Janes
2009/9/14 Pierre Frédéric Caillaud li...@peufeu.com I've done a little experiment with bulk inserts. = heap_bulk_insert() Behaves like heap_insert except it takes an array of tuples (HeapTuple *tups, int ntups). - Grabs a page (same as heap_insert) - While holding exclusive lock,

Re: [HACKERS] Bulk Inserts

2009-09-14 Thread Jeff Janes
2009/9/14 Pierre Frédéric Caillaud li...@peufeu.com 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

[HACKERS] Bulk inserts and usage_count

2007-05-15 Thread Heikki Linnakangas
While testing the buffer ring patch, I noticed that bulk inserts with both INSERT and COPY pin and unpin the buffer they insert to for every tuple. That means that the usage_count of all those buffers are bumped up to 5. That's gotta be bad if you try to run a COPY concurrently with other

Re: [HACKERS] Bulk inserts and usage_count

2007-05-15 Thread Jim C. Nasby
On Tue, May 15, 2007 at 04:37:28PM +0100, Heikki Linnakangas wrote: While testing the buffer ring patch, I noticed that bulk inserts with both INSERT and COPY pin and unpin the buffer they insert to for every tuple. That means that the usage_count of all those buffers are bumped snip A fix