Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XzYtD-0001uu-3z for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Dec 2014 22:40:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XzYtC-0005pd-Cs for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Dec 2014 22:40:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XzYtA-0005ox-RU for pgsql-hackers@postgresql.org; Fri, 12 Dec 2014 22:40:44 +0000 Received: from 01.zmailcloud.com ([192.198.85.104] helo=mx-out-1.zmailcloud.com) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XzYt7-0000cf-9Y for pgsql-hackers@postgresql.org; Fri, 12 Dec 2014 22:40:42 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id 2C53D56777A; Fri, 12 Dec 2014 16:40:40 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 20FBD601A2; Fri, 12 Dec 2014 16:40:40 -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 YEHXO0d0LPdg; Fri, 12 Dec 2014 16:40:40 -0600 (CST) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id F3A6B603A8; Fri, 12 Dec 2014 16:40:39 -0600 (CST) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id DD291603A5; Fri, 12 Dec 2014 16:40:39 -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 JqGANj6bm3Lt; Fri, 12 Dec 2014 16:40:39 -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 5C685601A2; Fri, 12 Dec 2014 16:40:39 -0600 (CST) Message-ID: <548B6EE3.3020309@agliodbs.com> Date: Fri, 12 Dec 2014 14:40:35 -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: Tom Lane , Claudio Freire CC: Pg Hackers Subject: Re: On partitioning References: <20140829155607.GF7705@eldon.alvh.no-ip.org> <015b01d00eab$56d37700$047a6500$@lab.ntt.co.jp> <002d01d01359$290cb4a0$7b261de0$@lab.ntt.co.jp> <007b01d015c6$373c21e0$a5b465a0$@lab.ntt.co.jp> <548B5E01.5060005@BlueT! reble.com> <9766.1418422242@sss.pgh.pa.us> 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/12/2014 02:10 PM, Tom Lane wrote: > Actually, I'm not sure that's what we want. I thought what we really > wanted here was to postpone partition-routing decisions to runtime, > so that the behavior would be efficient whether or not the decision > could be predetermined at plan time. > > This still leads to the same point Robert is making: the routing > decisions have to be cheap and fast. But it's wrong to think of it > in terms of planner proofs. The other reason I'd really like to have the new partitioning taken out of the planner: expressions. Currently, if you have partitions with constraints on, day, "event_date", the following WHERE clause will NOT use CE and will scan all partitions: WHERE event_date BETWEEN ( '2014-12-11' - interval '1 month' ) and '2014-12-11'. This is despite the fact that the expression above gets rewritten to a constant by the time the query is executed; by then it's too late. To say nothing of functions like to_timestamp(), now(), etc. As long as partitions need to be chosen at plan time, I don't see a good way to fix the expression problem. -- 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