Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 7630B635FE5 for ; Tue, 20 Jul 2010 12:42:03 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 57168-05 for ; Tue, 20 Jul 2010 15:41:56 +0000 (UTC) X-Greylist: delayed 00:06:37.874716 by SQLgrey-1.7.6 Received: from oproxy2-pub.bluehost.com (oproxy2-pub.bluehost.com [67.222.39.60]) by mail.postgresql.org (Postfix) with SMTP id B3A84635FFA for ; Tue, 20 Jul 2010 12:41:55 -0300 (ADT) Received: (qmail 11640 invoked by uid 0); 20 Jul 2010 15:35:15 -0000 Received: from unknown (HELO box498.bluehost.com) (66.147.242.98) by oproxy2.bluehost.com with SMTP; 20 Jul 2010 15:35:15 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=consistentstate.com; h=Received:From:Organization:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-Disposition:Message-Id:X-Identified-User; b=rSzFbSjLe5U5qscG3f8VxI7Wi+Q5G4e8p6a/b8ZNjsSYtseMnvtdb/fxwA08O0YJovfbr39zDBdoNYg5Iw9flCL0Vy+v/rWF3YIMEr4iBwonFIQMgHzeACHmBAAGXKMe; Received: from 173-164-51-9-colorado.hfc.comcastbusiness.net ([173.164.51.9] helo=[192.168.1.136]) by box498.bluehost.com with esmtpsa (SSLv3:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1ObEqh-0004Hz-8M; Tue, 20 Jul 2010 09:35:15 -0600 From: Kevin Kempter Organization: Consistent State To: pgsql-performance@postgresql.org Subject: dates and partitioning Date: Tue, 20 Jul 2010 09:36:07 -0600 User-Agent: KMail/1.9.4 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201007200936.07736.cs_dba@consistentstate.com> X-Identified-User: {3049:box498.bluehost.com:consist3:consistentstate.com} {sentby:smtp auth 173.164.51.9 authed with kevink+consistentstate.com} X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-10 required=5 tests=BAYES_40=-0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/289 X-Sequence-Number: 39678 Hi All; we have a table partitioned by day, the check constraint on the child tables looks like this (this is the may 31st partition): CHECK (stime >= '2010-05-30 00:00:00+00'::timestamp with time zone AND stime <= '2010-05-30 23:59:59+00'::timestamp with time zone) We have a python based app that creates code like this: select * from table_a a, table_b b, table_d d where a.id = b.id and b.id = d.id and stime >= timestamp %s at time zone \'UTC\' and stime < timestamp %s at time zone \'UTC\' and stime >= timestamp %s at time zone d.name and stime < timestamp %s at time zone d.name ... so here's my questions: 1) the above app generated query pshows up like this in pg_stat_activity: and stime >= timestamp E'2010-07-17' at time zone 'UTC' and stime < timestamp E'2010-07-21' at time zone 'UTC' and stime >= timestamp E'2010-07-18' at time zone d.name and stime < timestamp E'2010-07-19' at time zone d.name what's the E'date' from? and why does it show up this way? 2) the above query creates a plan that does a sequential scan & filter on every partition. Why won't it only hit the correct partitions? Is it due to the way the date was specified? or maybe the "at time zone" syntax? Thanks in advance...