Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id A37EE73FD6D for ; Sat, 9 Jun 2012 14:59:03 -0300 (ADT) Received: from 74-93-229-125-colorado.hfc.comcastbusiness.net ([74.93.229.125] helo=mail.consistentstate.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SdPwC-0007kO-Nm for pgsql-performance@postgresql.org; Sat, 09 Jun 2012 17:59:01 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.consistentstate.com (Postfix) with ESMTP id 7C4053053D9 for ; Sat, 9 Jun 2012 11:58:46 -0600 (MDT) X-Virus-Scanned: amavisd-new at consistentstate.com Received: from mail.consistentstate.com ([127.0.0.1]) by localhost (mail.consistentstate.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dOECjjkbBtq2 for ; Sat, 9 Jun 2012 11:58:45 -0600 (MDT) Received: from Issac.consistentstate.com (c-67-165-192-103.hsd1.co.comcast.net [67.165.192.103]) by mail.consistentstate.com (Postfix) with ESMTPSA id A6C1E3053D4 for ; Sat, 9 Jun 2012 11:58:45 -0600 (MDT) Message-ID: <4FD38ED4.3020003@consistentstate.com> Date: Sat, 09 Jun 2012 11:58:44 -0600 From: Kevin Kempter User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: partitioning performance question Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.9 (/) X-Archive-Number: 201206/52 X-Sequence-Number: 47078 Hi All; We have a client that has a table where large blobs (bytea) are stored. the table has a key column that is numbers (like 112362) but unfortunately it's a varchar column so the blobs are accessed via queries like: select * from bigtable where keycol = '217765' The primary reason we want to partition the table is for maintenance, the table is well over 1.2 Terabytes in size and they have never successfully vacuumed it. However I don't want to make performance even worse. The table does have a serial key, I'm thinking the best options will be to partition by range on the serial key, or maybe via the keycol character column via using an in statement on the check constraints, thus allowing the planner to actually leverage the above sql. I suspect doing a typecast to integer in the check constraints will prove to be a bad idea if the keycol column remains a varchar. Thoughts? Here's the table: Table "problemchild" Column | Type | Modifiers -----------+--------------------------+-------------------------------------------------------------------- keycol | character varying | blob_data | bytea | removed_date | timestamp with time zone | alt_key | bigint | not null default nextval('problemchild_alt_key_seq'::regclass) Indexes: "pc_pkey" PRIMARY KEY, btree (alt_key) "key2" btree (keycol) Thanks in advance