Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 9B81818E38DA for ; Thu, 12 Jan 2012 14:24:53 -0400 (AST) Received: from smtp.01.com ([199.36.142.181]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RlPKT-0007Tz-Qu for pgsql-performance@postgresql.org; Thu, 12 Jan 2012 18:24:53 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 43C8F4F49E3 for ; Thu, 12 Jan 2012 12:24:37 -0600 (CST) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VRvp2Q0lB4UO for ; Thu, 12 Jan 2012 12:24:37 -0600 (CST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 1EABA4F48E9 for ; Thu, 12 Jan 2012 12:24:37 -0600 (CST) Received: from Sidney-Stratton.local (70-36-143-92.dsl.dynamic.sonic.net [70.36.143.92]) by smtp-out-2.01.com (Postfix) with ESMTPSA id D2F854F4780 for ; Thu, 12 Jan 2012 12:24:36 -0600 (CST) Message-ID: <4F0F2564.6030702@agliodbs.com> Date: Thu, 12 Jan 2012 10:24:36 -0800 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.24) Gecko/20111103 Lightning/1.0b2 Thunderbird/3.1.16 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Partitioning by status? References: In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/38 X-Sequence-Number: 46051 Mike, > Is it practical to partition on the status column and, eg, use triggers to > move a row between the two partitions when status is updated? Any > surprises to watch for, given the status column is actually NULL for active > data and contains a value when archived? When I've done this before, I've had a setup like the following: 1. One "active" partition 2. Multiple "archive" partitions, also partitioned by time (month or year) 3. stored procedure for archiving a record or records. I'd recommend against triggers because they'll be extremely inefficient if you need to archive a large number of rows at once. Also, (2) only really works if you're going to obsolesce (remove) archive records after a certain period of time. Otherwise the sub-partitioning hurts performance. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com