Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id A64161E16586 for ; Tue, 10 Jan 2012 13:09:56 -0400 (AST) Received: from mailout04.ims-firmen.de ([213.174.32.250]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RkfCq-0008FU-8n for pgsql-performance@postgresql.org; Tue, 10 Jan 2012 17:09:56 +0000 Received: from mailin01.ims-firmen.de ([192.168.1.110]) by mailout02.ims-firmen.de with esmtp (envelope-from ) id 1RkfCc-0008SM-Co for pgsql-performance@postgresql.org; Tue, 10 Jan 2012 18:09:38 +0100 Received: from [87.170.214.114] (helo=a-kretschmer.de) by mailin01.ims-firmen.de with esmtpsa (TLSv1:AES256-SHA:256) (envelope-from ) id 1RkfCc-0004BW-7A for pgsql-performance@postgresql.org; Tue, 10 Jan 2012 18:09:38 +0100 Received: from kretschmer by a-kretschmer.de with local (Exim 4.69) (envelope-from ) id 1RkfCb-0005Lv-21 for pgsql-performance@postgresql.org; Tue, 10 Jan 2012 18:09:37 +0100 Date: Tue, 10 Jan 2012 18:09:37 +0100 From: Andreas Kretschmer To: pgsql-performance@postgresql.org Subject: Re: Partitioning by status? Message-ID: <20120110170937.GA20023@tux> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! X-Lugdd: Gerd Kube X-Info: My name is root. Just root. And I am licensed to kill -9 User-Agent: Mutt/1.5.18 (2008-05-17) X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/32 X-Sequence-Number: 46045 Mike Blackwell wrote: > We have a set of large tables.  One of the columns is a status indicator > (active / archived).  The queries against these tables almost always include > the status, so partitioning against that seems to makes sense from a logical > standpoint, especially given most of the data is "archived" and most of the > processes want active records. > > 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? If i where you, i would try a partial index where status is null. But yes, partitioning is an other option, depends on your workload. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°