Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 4E6CA1337C25 for ; Wed, 27 Apr 2011 17:03:00 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 66093-04-7 for ; Wed, 27 Apr 2011 20:02:40 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id F0EDB1337FB1 for ; Wed, 27 Apr 2011 16:35:42 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QFAWI-0004FT-DJ for pgsql-admin@postgresql.org; Wed, 27 Apr 2011 21:35:30 +0200 Received: from frigga.summersault.com ([12.161.105.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Apr 2011 21:35:30 +0200 Received: from mark by frigga.summersault.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Apr 2011 21:35:30 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-admin@postgresql.org From: Mark Stosberg Subject: Re: best practice for moving millions of rows to child table when setting up partitioning? Date: Wed, 27 Apr 2011 15:35:14 -0400 Lines: 29 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: frigga.summersault.com User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: X-Enigmail-Version: 1.1.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.595 tagged_above=-10 required=5 tests=BAYES_00=-1.9, SARE_MILLIONSOF=0.315, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201104/240 X-Sequence-Number: 37421 > Similar posting on partition table, take this inputs before going > forward with partition table. > > http://archives.postgresql.org/pgsql-general/2011-04/msg00808.php > > Best solution given by Greg Smith as well Vick. Thanks for the replies. Today I reviewed the section on partitioning from Greg's High Performance book. I tried out the method of using an "update trigger" on the parent table to move rows child tables. In particular, I wanted to check whether the UPDATE statement would alter all the rows automatically, or if the underlying trigger would cause all the rows processed a row at a time. It appears from my test that the result of the UPDATE was going to appear all at once. I'm worried about the resource implications of inserting mullions of rows all at once. Someone else suggested writing a small program to insert the rows in s smaller chunks. I think that's the approach I'm going to consider taking. Thanks for the input! Mark