Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id BC8B8634A35 for ; Fri, 29 Jan 2010 19:50:44 -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 64679-05 for ; Fri, 29 Jan 2010 23:50:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ew0-f217.google.com (mail-ew0-f217.google.com [209.85.219.217]) by mail.postgresql.org (Postfix) with ESMTP id E830E63303F for ; Fri, 29 Jan 2010 19:50:33 -0400 (AST) Received: by ewy9 with SMTP id 9so252453ewy.3 for ; Fri, 29 Jan 2010 15:50:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=W4pZ8hmvs9XIjacarcYRurFL+zya9UnC2AknLfkf9e0=; b=X49xgfD2xPmpSDQQ7IrDBr+JBsw+xqQWi+KwPD6F1upki++aDnUoa/GyU552UFfLYB y3DVVebmFGbYnqd0Y75F12Y3cddkG8tmMEsFXeO5iQ+5WjWZxDGBZFQLsGAZHfkYtdKd BJ4W1+6ByJ7LIWh4rRfYkIL2/XpYBN9BNhW2c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=LMa90lUwzNHpopDsizxU/U1vRm7mFgNnjrVUlwb1X5KIpjwex7/FxMpbgeubT0HNjy Dzp4babCgXi8TgrLeIP3yUUTJruSZn0Oeu1cRCTcRplUMwcrYZn9T2KaCOEc3HjLYxk1 yqNUutuuzSr9LFX993nGlvX87IV/Xj4H3MQUI= MIME-Version: 1.0 Received: by 10.216.88.79 with SMTP id z57mr928552wee.22.1264809031957; Fri, 29 Jan 2010 15:50:31 -0800 (PST) In-Reply-To: <4B636022.90804@kickstone.com> References: <4B636022.90804@kickstone.com> Date: Fri, 29 Jan 2010 16:50:31 -0700 Message-ID: Subject: Re: Partitioning by letter question From: Scott Marlowe To: John Lister Cc: pgsql-sql@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.406 tagged_above=-10 required=5 tests=AWL=0.037, BAYES_00=-2.599, SUBJECT_FUZZY_TION=0.156 X-Spam-Level: X-Archive-Number: 201001/48 X-Sequence-Number: 33584 On Fri, Jan 29, 2010 at 3:24 PM, John Lister wrote: > 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 che= ck > constraints such as (id>=3D1000 and id<2000) then everything is fine and = the > planner correctly uses the right subset of the tables. However I would li= ke > to partition by the first letter and using something like this > substr(word,1,1)=3D'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 =A0something wrong or is there another better way to do this Have you tried: (word >=3D 'a' and word <'b') ?