Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 24F482E2E02 for ; Fri, 25 Jan 2008 19:27:17 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 92788-03 for ; Fri, 25 Jan 2008 19:27:06 -0400 (AST) Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by postgresql.org (Postfix) with ESMTP id B87E42E2E00 for ; Fri, 25 Jan 2008 19:27:06 -0400 (AST) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JIXwv-0007bV-9O for pgsql-performance@postgresql.org; Fri, 25 Jan 2008 15:27:05 -0800 Message-ID: <15099164.post@talk.nabble.com> Date: Fri, 25 Jan 2008 15:27:05 -0800 (PST) From: growse To: pgsql-performance@postgresql.org Subject: How do I bulk insert to a table without affecting read performance on that table? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: nabble@growse.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.03 tagged_above=0 required=5 tests=BAYES_00=-2.599, DNS_FROM_OPENWHOIS=1.13, WHOIS_MYPRIVREG=1.499 X-Spam-Level: X-Archive-Number: 200801/241 X-Sequence-Number: 28480 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-table--tp15099164p15099164.html Sent from the PostgreSQL - performance mailing list archive at Nabble.com.