Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 9EE4C635FAD for ; Fri, 29 Jan 2010 18:55:03 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 54802-06 for ; Fri, 29 Jan 2010 22:54:47 +0000 (UTC) X-Greylist: delayed 00:30:16.430512 by SQLgrey-1.7.6 Received: from mail.kickstone.com (smtp.kickstone.com [87.194.183.70]) by mail.postgresql.org (Postfix) with ESMTP id 3F6EF63606D for ; Fri, 29 Jan 2010 18:54:45 -0400 (AST) Received: from [80.225.58.208] (port=57818 helo=[192.168.6.10]) by mail.kickstone.com with esmtpa (Exim 4.69) (envelope-from ) id 1NazGL-0006Iv-Jg for pgsql-sql@postgresql.org; Fri, 29 Jan 2010 22:24:25 +0000 Message-ID: <4B636022.90804@kickstone.com> Date: Fri, 29 Jan 2010 22:24:34 +0000 From: John Lister User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Partitioning by letter question Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.443 tagged_above=-10 required=5 tests=BAYES_00=-2.599, SUBJECT_FUZZY_TION=0.156 X-Spam-Level: X-Archive-Number: 201001/47 X-Sequence-Number: 33583 Hi, I was wondering if this was possible. I'm trying to partition a table, which is straightforward enough thanks to the great documentation, but i have a question: If I partition using something like a product_id for example and have check constraints such as (id>=1000 and id<2000) then everything is fine and the planner correctly uses the right subset of the tables. However I would like to partition by the first letter and using something like this substr(word,1,1)='a' is ignored by the planner. From reading the docs I understand that complicated check constraints are ignored, but this doesn't seem overly complicated. Am i doing something wrong or is there another better way to do this Thanks John