Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Re: How do I bulk insert to a table without affecting read performance on that table?


  • From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
  • To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "growse" <nabble(at)growse(dot)com>
  • Cc: <pgsql-performance(at)postgresql(dot)org>
  • Subject: Re: How do I bulk insert to a table without affecting read performance on that table?
  • Date: Thu, 31 Jan 2008 17:06:20 -0600
  • Message-id: <47A2000C.EE98.0025.0@wicourts.gov> <text/plain>

>>> On Sat, Jan 26, 2008 at  7:39 AM, in message
<dcc563d10801260539r33c08e45o1932b5c6f2ac2907(at)mail(dot)gmail(dot)com>, "Scott Marlowe"
<scott(dot)marlowe(at)gmail(dot)com> wrote: 
> On Jan 26, 2008 5:42 AM, growse <nabble(at)growse(dot)com> wrote:
>> Scott Marlowe-2 wrote:
>> > Can you import to another table then
>> >
>> > begin;
>> > alter table realtable rename to garbage;
>> > alter table loadtable rename to realtable;
>> > commit;
>> >
>> > ?
>>
>> This is a possibility. My question on this is that would an ALTER TABLE real
>> RENAME TO garbage be faster than a DROP TABLE real?
> 
> I don't know.  They're both pretty fast.  I'd do a test, with parallel
> contention on the table and see.
 
We do something similar (using DROP TABLE) on a weekly cycle.
We get occasional errors, even with the database transaction.
I wonder whether we might dodge them by using the rename, and
then dropping the old table after a brief delay.
 
-Kevin
 





Home | Main Index | Thread Index

Privacy Policy | About PostgreSQL
Copyright © 1996 – 2012 PostgreSQL Global Development Group