Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0TXI-0006TL-2R for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2014 11:09:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y0TXG-0008Bg-UU for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2014 11:09:54 +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 1Y0TXF-0008BT-Hj for pgsql-hackers@postgresql.org; Mon, 15 Dec 2014 11:09:53 +0000 Received: from h092-net00.csimad.doblenet.net ([213.27.130.92] helo=quark.amimatica.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0TXC-0003Hg-Br for pgsql-hackers@postgresql.org; Mon, 15 Dec 2014 11:09:52 +0000 Received: from vortex.hq.g4ii.com (182.Red-88-26-239.staticIP.rima-tde.net [88.26.239.182]) by quark.amimatica.com (Postfix) with ESMTPA id 3D30E4BE; Mon, 15 Dec 2014 12:09:48 +0100 (CET) Message-ID: <548EC179.6080002@adv-solutions.net> Date: Mon, 15 Dec 2014 12:09:45 +0100 From: =?UTF-8?B?Sm9zw6kgTHVpcyBUYWxsw7Nu?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.0 MIME-Version: 1.0 To: Claudio Freire , Amit Langote CC: Alvaro Herrera , Josh Berkus , Tom Lane , Pg Hackers Subject: Re: On partitioning References: <007b01d015c6$373c21e0$a5b465a0$@lab.ntt.co.jp> <9766.1418422242@sss.pgh.pa.us> <548B6EE3.3020309@agliodbs.com> <20141213020946.GG1768@alvh.no-ip.org> <001601d0180c$a212f550$e638dff0$@lab.ntt.co.jp> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed 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/15/2014 07:42 AM, Claudio Freire wrote: > [snip] > If you do that, you start with empty partitions, and each insert > updates the BRIN tuple. Avoiding concurrency loss in this case would > be tricky, but in theory this could allow very general partition > exclusion. In fact it could even work with constraint exclusion right > now: you'd have a single-tuple BRIN index for each partition and > benefit from it. But you don't need to pay the price of updating BRIN > indexes, as min-max tuples for each partition can be produced while > creating the partitions if the syntax already provides the > information. Then, it's just a matter of querying this meta-data which > just happens to have the form of a BRIN tuple for each partition. Yup. Indeed this is the way I outlined in my previous e-mail. The only point being: Why bother with BRIN when we already have the range machinery, and it's trivial to add pointers to partitions from each range? I suggested that BRIN would solve a situation when the amount of partitions is huge (say, thousands) and we might need to be able to efficiently locate the appropriate partition. In this situation, a linear search might become prohibitive, or the data structure (a simple B-Tree, maybe) become too big to be worth keeping in memory. This is where being able to store the "partition index" on disk would be interesting. Moreover, I guess that ---by using this approach (B-Tree[range]->partition_id and/or BRIN)--- we could efficiently answer the question "do we have any tuple with this key in some partition?" which AFAICS is pretty close to us having "global indexes". Regards, / J.L. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers