Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y13ve-0005FX-GC for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2014 02:01:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y13vd-0003bv-QS for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Dec 2014 02:01:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y13vc-0003bp-KO for pgsql-hackers@postgresql.org; Wed, 17 Dec 2014 02:01:28 +0000 Received: from 01.zmailcloud.com ([192.198.85.104] helo=mx-out-1.zmailcloud.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y13vT-0004ap-Q0 for pgsql-hackers@postgresql.org; Wed, 17 Dec 2014 02:01:27 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id 5B76C565852; Tue, 16 Dec 2014 20:01:18 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 4D364603FF; Tue, 16 Dec 2014 20:01:18 -0600 (CST) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B8FJubowkto1; Tue, 16 Dec 2014 20:01:18 -0600 (CST) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 2112060405; Tue, 16 Dec 2014 20:01:18 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 0A9C060404; Tue, 16 Dec 2014 20:01:18 -0600 (CST) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id bSDf-2EtJWyG; Tue, 16 Dec 2014 20:01:17 -0600 (CST) Received: from [172.47.23.103] (50-0-89-106.dsl.dynamic.fusionbroadband.com [50.0.89.106]) by smtp-out-2.01.com (Postfix) with ESMTPSA id 28817603FF; Tue, 16 Dec 2014 20:01:16 -0600 (CST) Message-ID: <5490E3EB.8020904@agliodbs.com> Date: Tue, 16 Dec 2014 18:01:15 -0800 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Robert Haas CC: Amit Langote , Alvaro Herrera , Claudio Freire , Tom Lane , Pg Hackers Subject: Re: On partitioning References: <9766.1418422242@sss.pgh.pa.us> <548B6EE3.3020309@agliodbs.com> <20141213020946.GG1768@alvh.no-ip.org> <001601d0180c$a212f550$e638dff0$@lab.ntt.co.jp> <54907DD9.7060306@agliodbs.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 12/16/2014 05:52 PM, Robert Haas wrote: > But in a more complicated case where the value there isn't known until > runtime, yeah, it scans everything. I'm not sure what the best way to > fix that is. If the partition bounds were stored in a structured way, > as we've been discussing, then the Append or Merge Append node could, > when initialized, check which partition the id = X qual routes to and > ignore the rest. But that's more iffy with the current > representation, I think. Huh. I was just testing: WHERE event_time BETWEEN timestamptz '2014-12-01' and ( timestamptz '2014-12-01' + interval '1 month') In that case, the expression above got folded to constants by the time Postgres did the index scans, but it scanned all partitions. So somehow (timestamptz + interval) doesn't get constant-folded until after planning, at least not on 9.3. And of course this leaves out common patterns like "now() - interval '30 days'" or "to_timestamp('20141201','YYYYMMDD')" Anyway, what I'm saying is that I personally regard the inability to handle even moderately complex expressions a major failing of our existing partitioning scheme (possibly its worst single failing), and I would regard any new partitioning feature which didn't address that issue as suspect. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers