Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id EBB4B2E2D6A for ; Fri, 25 Jan 2008 22:07:04 -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 49965-07 for ; Fri, 25 Jan 2008 22:07:00 -0400 (AST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.181]) by postgresql.org (Postfix) with ESMTP id 0A3082E022D for ; Fri, 25 Jan 2008 22:06:59 -0400 (AST) Received: by wa-out-1112.google.com with SMTP id m38so1521367waf.5 for ; Fri, 25 Jan 2008 18:06:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=roq+/h7dRalBOUPzKoBObrcvENGE8rlU0L9yC9hJ3sg=; b=MyW0/ZcLWELmjvtY35pzOMXEARfWFRkUMb51srIwJfsOlSmpi+f5chAU+CbWOvA2KGXFxms/kC+kMjC3OWxv5FWoHDNXzW0y2Q2o/k1TzrVQ7TbV5FEaQjEpqT3hDZTEhHPmwSuwk4WkrhWVPwg70tgoXSwzL25QWTKPJFtTxUk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WnpCnLD4IS1PIWu2EJrCegECnFhNCKt9k12WPn/HTAT0aRolPX/APRZd3Yd41tPanXYDTYEQqbJsbvViKBrQQveC1OMLEGrCP2RbSWekGz0FvMpJ7XGzPVLqJxk7DKbWxBARixJ/JFOj2Eh6zSfsEkRO+NwBGSrLwEYFlGH7JeQ= Received: by 10.114.123.1 with SMTP id v1mr404515wac.147.1201313218303; Fri, 25 Jan 2008 18:06:58 -0800 (PST) Received: by 10.114.133.5 with HTTP; Fri, 25 Jan 2008 18:06:58 -0800 (PST) Message-ID: Date: Fri, 25 Jan 2008 20:06:58 -0600 From: "Scott Marlowe" To: growse Subject: Re: How do I bulk insert to a table without affecting read performance on that table? Cc: pgsql-performance@postgresql.org In-Reply-To: <15099164.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <15099164.post@talk.nabble.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200801/242 X-Sequence-Number: 28481 On Jan 25, 2008 5:27 PM, growse wrote: > > 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. Can you import to another table then begin; alter table realtable rename to garbage; alter table loadtable rename to realtable; commit; ? > > 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. > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >