Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eLHpG-00014N-9Z for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Dec 2017 00:08:06 +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 1eLHpF-0006C8-S9 for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Dec 2017 00:08:05 +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 1eLHpF-0006Bw-Ih for pgsql-hackers@lists.postgresql.org; Sun, 03 Dec 2017 00:08:05 +0000 Received: from smtprelay0193.b.hostedemail.com ([64.98.42.193] helo=smtprelay.b.hostedemail.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eLHpC-0007zx-T7 for pgsql-hackers@postgresql.org; Sun, 03 Dec 2017 00:08:04 +0000 Received: from filter.hostedemail.com (10.5.19.248.rfc1918.com [10.5.19.248]) by smtprelay01.b.hostedemail.com (Postfix) with ESMTP id 487FE2D2A12; Sun, 3 Dec 2017 00:08:01 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,alvherre@alvh.no-ip.org,:::::::::,RULES_HIT:41:355:379:599:967:973:988:989:1260:1277:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1534:1542:1593:1594:1595:1596:1711:1730:1747:1777:1792:1981:2194:2199:2393:2525:2560:2563:2682:2685:2828:2859:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4470:4605:5007:6261:7903:7904:9025:9121:10004:10400:10848:11232:11658:11914:12296:12663:13141:13161:13229:13230:13439:13894:13895:21080:21433:21627:30012:30054,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: coat79_6309e3290d304 X-Filterd-Recvd-Size: 3101 Received: from alvin.alvh.no-ip.org (unknown [191.125.99.76]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf09.b.hostedemail.com (Postfix) with ESMTPA; Sun, 3 Dec 2017 00:08:00 +0000 (UTC) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 842CF11D0; Fri, 1 Dec 2017 19:10:27 -0300 (-03) Date: Fri, 1 Dec 2017 19:10:27 -0300 From: Alvaro Herrera To: David Rowley Cc: Simon Riggs , Robert Haas , Pg Hackers , Maksim Milyutin Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table Message-ID: <20171201221027.edqapmu4gcisvqbz@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Rowley wrote: > So, then this patch is only really intended as a syntax shortcut for > mass adding of indexes to each partition? This patch is intended to serve as a basis on which to construct further features, just like every other patch we apply. > I feel like we could do better here with little extra effort. The > DETACH index feature does not really seem required for this patch. I > think just ensuring a matching index exists on each leaf partition and > creating any which don't exist before creating the index on the target > partitioned table seems like the correct solution. That way we can > make that index indisvalid flag have a valid meaning all the time. > Some later patch can invent some way to replace a bloated index. What you're saying is that I've written code for A+B, and you're "interested in C (which is incompatible with B), so can we have A+C and drop B". But in reality, there exists (unwritten) D that solves the incompatiblity between B and C. I'm just saying it's essentially the same to postpone C+D than to postpone B+D, and I already have B written; plus that way we don't have to come up with some novel way to handle pg_dump support. So can we get A+B committed and discuss C+D later? A = partitioned indexes B = pg_dump support based on ATTACH C = your proposed planner stuff D = correct indisvalid setting for partitioned indexes (set to false when a partition does not contain the index) The patch in this thread is A+B. > Perhaps later we can invent some generic way to replace a physical > leaf index for a given partitioned index perhaps with the same patch > that might allow us to replace an index which is used by a constraint, > which to me seems like a feature we should have had years ago. This is a hypothetical feature E which would be nice (for partitioned indexes and for ordinary indexes too) but is not strictly necessary. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services