Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1adSRe-0003gP-M3 for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Mar 2016 00:57:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1adSRe-00078z-1Y for pgsql-hackers@arkaria.postgresql.org; Wed, 09 Mar 2016 00:57:46 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1adSRd-00078r-Bl for pgsql-hackers@postgresql.org; Wed, 09 Mar 2016 00:57:45 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1adSRW-0005wk-AH for pgsql-hackers@postgresql.org; Wed, 09 Mar 2016 00:57:44 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id u290vZJQ005289; Wed, 9 Mar 2016 09:57:35 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id DED6D5F611; Wed, 9 Mar 2016 09:57:34 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id BFBA45F594; Wed, 9 Mar 2016 09:57:34 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTP id A6BAC400BC2; Wed, 9 Mar 2016 09:57:34 +0900 (JST) Subject: Re: Declarative partitioning References: <55D3093C.5010800@lab.ntt.co.jp> <563341AE.5010207@lab.ntt.co.jp> <564EE560.60106@lab.ntt.co.jp> <20151120114446.GN614468@alvherre.pgsql> <566E6C48.9080500@lab.ntt.co.jp> <5678ACBC.8050809@lab.ntt.co.jp> <5698CE6D.3070907@lab.ntt.co.jp> <56C55973.80309@lab.ntt.co.jp> <56CD6598.4090302@lab.ntt.co.jp> <56DE2D4B.1040001@lab.ntt.co.jp> From: Amit Langote Message-ID: <56DF74F0.7060404@lab.ntt.co.jp> Date: Wed, 9 Mar 2016 09:57:20 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Corey Huinker Cc: Robert Haas , Pg Hackers X-TM-AS-MML: disable X-Pg-Spam-Score: -2.6 (--) 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 Hi, On 2016/03/09 9:17, Corey Huinker wrote: >> >> Sorry for replying so late. > No worries! We have jobs to do aside from this. Thanks! >> Everything seemed to go dandy until I tried FOR VALUES (blah , blah], >> where psql wouldn't send the command string without accepting the closing >> parenthesis, :(. So maybe I should try to put the whole thing in '', that >> is, accept the full range_spec in a string, but then we are back to >> requiring full-blown range parse function which I was trying to avoid by >> using the aforementioned grammar. So, I decided to move ahead with the >> following grammar for time being: >> >> START (lower-bound) [ EXCLUSIVE ] >> | END (upper-bound) [ INCLUSIVE ] >> | START (lower-bound) [ EXCLUSIVE ] END (upper-bound) [ INCLUSIVE ] >> >> Where, >> >> *-bound: a_expr >> | *-bound ',' a_expr >> >> Note that in the absence of explicit specification, lower-bound is >> inclusive and upper-bound is exclusive. > > Thanks for trying. I agree that it would be a full blown range parser, and > I'm not yet advanced enough to help you with that. > > So presently partitions that are unbounded on the lower end aren't > possible, but that's a creation syntax issue, not an infrastructure issue. > Correct? In case it wasn't apparent, you can create those: FOR VALUES END (upper-bound) [INCLUSIVE] which is equivalent to: FOR VALUES '(, upper-bound)' or FOR VALUES '(, upper-bound]' >>> Question: I haven't dove into the code, but I was curious about your >> tuple >>> routing algorithm. Is there any way for the algorithm to begin it's scan >> of >>> candidate partitions based on the destination of the last row inserted >> this >>> statement? I ask because most use cases (that I am aware of) have data >> that >>> would naturally cluster in the same partition. >> >> No. Actually the tuple-routing function starts afresh for each row. For >> range partitions, it's binary search over an array of upper bounds. There >> is no row-to-row state caching in the partition module itself. >> >> > bsearch should be fine, that's what I've used in my own custom partitioning > schemes. > > Was there a new patch, and if so, is it the one you want me to kick the > tires on? You didn't miss any. I need a little more time to send the next revision with significant design overhaul. Thanks, Amit -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers