Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXZzf-0000F3-8M for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jan 2018 21:57:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eXZze-0003Io-JW for pgsql-hackers@arkaria.postgresql.org; Fri, 05 Jan 2018 21:57:38 +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_2) (envelope-from ) id 1eXZze-0003Ie-A8 for pgsql-hackers@lists.postgresql.org; Fri, 05 Jan 2018 21:57:38 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eXZzb-0003fJ-O3 for pgsql-hackers@postgresql.org; Fri, 05 Jan 2018 21:57:37 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 14F1B21DE6; Fri, 5 Jan 2018 16:57:34 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Fri, 05 Jan 2018 16:57:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=/fu+m1 o3IV0hdQ9kGOHjBuolfredixuRs7YkHMinTLw=; b=b/1EU6kCozxFq6LX7KHPm5 idAU8mWssr37qwEPmW9YgqkdX+UzoyRFAKqLGvS+u2AkEjTH3FscHXSyew1BTg1Y af1/8Ly7zI3XxWDFhUSnbaWh1L5Jb26OeRwildbElGmQsD5kkLw71SkP6VLwJcOq chTgMc2YLHF2Il+EZPoR7a0YZ4EdCcZq2LTJdPu/oS0ZWEIdvjCcyJuCydWIwjqz rdKqN62lMppY3Evc7HFgCkgz3WJ9OSkxBuUTydLX6JKmrV0Lt/7m+nmvagC3A/Od sKiSWtJsXwdNsbzvASuWq3ZZd2/D7WjusuC80HAKx/Hi+jf0PaqANJ/nOgbN84bQ == X-ME-Sender: Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id A9C95247FF; Fri, 5 Jan 2018 16:57:33 -0500 (EST) Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table To: David Rowley , Alvaro Herrera References: <584730ad-6736-10bc-b5fa-251d4873b8ad@2ndquadrant.com> <20180104220133.6sa4zpf5liurxhte@alvherre.pgsql> Cc: Robert Haas , Amit Langote , Jesper Pedersen , Simon Riggs , Pg Hackers , Maksim Milyutin From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: <803ac362-d8ef-ba67-daf5-b3263718070b@2ndquadrant.com> Date: Fri, 5 Jan 2018 16:57:33 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/4/18 23:08, David Rowley wrote: > On 5 January 2018 at 11:01, Alvaro Herrera wrote: >> (The more I think of this, the more I believe that pg_inherits is a >> better answer. Opinions?) > > I admit to not having had a chance to look at any code with this yet, > but I'm just thinking about a case like the following. > > CREATE TABLE part (a INT, b INT) PARTITION BY RANGE (a); > CREATE TABLE part_a1 PARTITION OF part FOR VALUES FROM (0) TO (10) > PARTITION BY RANGE (b); > CREATE TABLE part_a1_b1 PARTITION OF part_a1 FOR VALUES FROM (0) TO (10); > > CREATE INDEX ON part_a1 (a); -- sub-partition index (creates index on > part_a1_b1) > > CREATE INDEX ON part (a); -- What do we do here? > > Should we: > > 1. Create another identical index on part_a1_b1; or > 2. Allow the existing index on part_a1_b1 to have multiple parents; or > 3. ERROR... (probably not) 4. It should adopt part_a1 and its subindexes into its hierarchy. That shouldn't be a problem under the current theory, should it? -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services