Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TscJv-0004ZK-Ib for pgsql-performance@arkaria.postgresql.org; Tue, 08 Jan 2013 16:46:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TscJv-0001uC-3b for pgsql-performance@arkaria.postgresql.org; Tue, 08 Jan 2013 16:46:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TscJu-0001u7-7d for pgsql-performance@postgresql.org; Tue, 08 Jan 2013 16:46:34 +0000 Received: from qmta11.emeryville.ca.mail.comcast.net ([2001:558:fe2d:44:76:96:27:211]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TscJq-0000rO-AX for pgsql-performance@postgresql.org; Tue, 08 Jan 2013 16:46:33 +0000 Received: from omta15.emeryville.ca.mail.comcast.net ([76.96.30.71]) by qmta11.emeryville.ca.mail.comcast.net with comcast id lTvb1k00E1Y3wxoABUmSBK; Tue, 08 Jan 2013 16:46:26 +0000 Received: from [192.168.1.176] ([69.142.185.164]) by omta15.emeryville.ca.mail.comcast.net with comcast id lUmL1k00G3ZEZL58bUmR1l; Tue, 08 Jan 2013 16:46:25 +0000 Message-ID: <50EC4D3D.9060209@comcast.net> Date: Tue, 08 Jan 2013 11:45:49 -0500 From: AJ Weber User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Jeff Janes CC: "pgsql-performance@postgresql.org" Subject: Re: Partition table in 9.0.x? References: <50E65B85.9000001@synedra.com> <50E74A33.5000204@comcast.net> <50E997C5.2000301@comcast.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1357663586; bh=9SnRAldCUyQG4wIpRptNDO7SW3tHvEOz76ENpq+u42E=; h=Received:Received:Message-ID:Date:From:MIME-Version:To:Subject: Content-Type; b=MVUsbJ/5lTKdPTLjzhTA+ggVEt8dZTfoOdWWpx8jIwg49VqQMoS8dla5Itcv/Ycmx Un8mG4puLQ8YsV+R9CkJ5jfU5fu3WKGT+luqWx2LuuyXxo9PwPP993wFh3wrmfU378 oNBWxfMMCvBvKkPB1Syxir3ukRTetozersy7soOon5rTQlJaw9/j5Axe5C/ThPTw+z 6YiSkLE8AyY5XXBvW2zlA+atXe3xGANc3jf5h5kLkcnOWHoTFyvKWqcIj09r9VknlZ u2LC+qwm3ripKhI7o0wp2B+SBXtQ0cRKst/R+a5G1/4zYZy+gKo/eduj7HB1Vd3mPP k906+Jzxct1MA== X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org > > It probably does, but from psql command line, you can do \d+ and \di+ \d+ doesn't appear to display any size information. > > If you have little control over your storage and are already IO bound, > and the tables are growing rapidly, you may need to rethink that > "deletes are rare" bit. So the inserts and updates do target a hot > part, while the selects are evenly spread? > > In that case, it is very important to know if the slow part are the > selects, or the insert and deletes. If the selects are slow, and the > hot rows for selects can't be gathered together into a hot partition, > then after clustering they will still be slow as the disk will still > have to seek all over the place (massive data-mining type selects > might be an exception to that, but I wouldn't count on it). Since order_num is sequential, I could partition on it in broad (sequential) ranges. That would put all recent/new rows in one table-partition that would be a fraction of the size of the overall (unpartitioned) table. I guess that would require manual maintenance over-time (to switch to another, new partition as each grows). > > I think it is a matter of semantics. A small table is poor candidate > for partitioning even if it has an excellent key to use for > partitioning. A large table could be a good candidate up until you > realize it doesn't have a good key to use, at which point it stops > being a good candidate (in my opinion). > My first idea to evenly-partition the table was to use the order_num and do a "mod" on it with the number of tables I wanted to use. That would yield a partition-table number of 0-mod, and all rows for the same order would stay within the same partition-table. However, you're right in thinking that a search for orders could -- really WOULD -- require retrieving details from multiple partitions, probably increasing IO. So maybe the sequential partitioning (if at all) is better, just more maintenance down-the-road. > > Was the order_num (from the parent table) the leading field of the 4 > column PK? If not, you might want to reorder the PK so that it is the > leading field and cluster again. Or if reordering the PK columns is > not convenient, make a new index on the order_num and cluster on that > (perhaps dropping the index after the cluster, if it no longer serves > a purpose) > Yes, the order_num is the first column in the PK, and our main browse queries use, at a minimum, the first 2-3 columns in that PK in their where-clause. Many thanks again for all the input! -AJ -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance