pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: growse <nabble@growse.com>
To: pgsql-performance@postgresql.org
Subject: How do I bulk insert to a table without affecting read performance on that table?
Date: Fri, 25 Jan 2008 15:27:05 -0800 (PST)
Message-ID: <15099164.post@talk.nabble.com> (raw)


Hi,

I've got a pg database, and a batch process that generates some metadata to
be inserted into one of the tables. Every 15 minutes or so, the batch script
re-calculates the meta data (600,000 rows), dumps it to file, and then does
a TRUNCATE table followed by a COPY to import that file into the table.

The problem is, that whilst this process is happening, other queries against
this table time out. I've tried to copy into a temp table before doing an
"INSERT INTO table (SELECT * FROM temp)", but the second statement still
takes a lot of time and causes a loss of performance.

So, what's the best way to import my metadata without it affecting the
performance of other queries?

Thanks,

Andrew 
-- 
View this message in context: http://www.nabble.com/How-do-I-bulk-insert-to-a-table-without-affecting-read-performance-on-that-tab...
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.




view thread (5+ messages)  latest in thread

Message-ID: <15099164.post@talk.nabble.com>
Permalink:  ../15099164.post@talk.nabble.com/
Also on:    postgresql.org/message-id/15099164.post@talk.nabble.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: nabble@growse.com
  Subject: Re: How do I bulk insert to a table without affecting read performance on that table?
  In-Reply-To: <15099164.post@talk.nabble.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox