Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYeKI-0007ja-A6 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2018 20:47:22 +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 1eYeKH-0003AE-Tg for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Jan 2018 20:47:21 +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 1eYeKH-0003A4-Jx for pgsql-hackers@lists.postgresql.org; Mon, 08 Jan 2018 20:47:21 +0000 Received: from mail-qk0-f194.google.com ([209.85.220.194]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eYeKE-00015P-EL for pgsql-hackers@postgresql.org; Mon, 08 Jan 2018 20:47:20 +0000 Received: by mail-qk0-f194.google.com with SMTP id i17so11502387qke.0 for ; Mon, 08 Jan 2018 12:47:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=srqXs6zyNQ2LfJ2NnuXeYIapL+VPn1RgG4NRu13h2ww=; b=NukDfc+LzJX70aDdKcz5xiy3enWIjw8INe23ZdEisusIaxD8cBcIEIOa60qotXjbYr UE24uPrvPInbiAcvhjSnY4ejr4Ey/Da0+dVMpI5UgWoGikwawkf1zs71WFmsNXC2Xjdy XE3ux6cMAjaL6TMpI3m7QjwLUmCnriYEPeQ88glZcQ2/aNrlhqOYiGpuevjoEx4DDyH0 XvV3Sji9lOBDvCEStvJxQvIHysC+nAH6qp9Qsa2pV8k/jhDxXiZ7XVaMPo9dcf2IYWy0 5EMtLSyzH7xsV0Uen2l0/vJt7UMZziiaD20CwToK8u2E86rsB8+FvMOW+MgpPCkU5I5G XXMw== X-Gm-Message-State: AKwxytfFl1zoq2tvgHKouCGwEUUYUnaM7bT/14pTDfMNq5yPQemBJKrl xuj5sVGSz0ljYzPW3pWimC551w== X-Google-Smtp-Source: ACJfBovhmIPVHFizGt/1+elW0DYVLz3NMD/XsZdRnJ/KQCnen/VCPyV9+iji/X3hza5ye1W8Dir5vA== X-Received: by 10.55.1.207 with SMTP id u76mr3344967qkg.344.1515444436637; Mon, 08 Jan 2018 12:47:16 -0800 (PST) Received: from localhost.localdomain (c-24-61-8-151.hsd1.ma.comcast.net. [24.61.8.151]) by smtp.gmail.com with ESMTPSA id a187sm932408qkc.35.2018.01.08.12.47.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 12:47:16 -0800 (PST) Reply-To: jesper.pedersen@redhat.com Subject: Re: [HACKERS] Proposal: Local indexes for partitioned table To: Alvaro Herrera Cc: Amit Langote , Robert Haas , David Rowley , Simon Riggs , Pg Hackers , Maksim Milyutin References: <20180108203638.6di3uo7r7vqfsvda@alvherre.pgsql> From: Jesper Pedersen Organization: Red Hat Message-ID: <3cc142e1-82c7-0d47-681b-59d519606f4e@redhat.com> Date: Mon, 8 Jan 2018 15:47:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20180108203638.6di3uo7r7vqfsvda@alvherre.pgsql> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Alvaro, On 01/08/2018 03:36 PM, Alvaro Herrera wrote: > Jesper Pedersen wrote: > >> Maybe a warning for existing indexes on the same column(s), but with a >> different type, should be emitted during ATTACH, e.g. > >> [detach one partition, replace index with a different one, attach >> partition] > >> Of course, this could also fall under index maintenance and no warning >> emitted. Docs have "Each partition is first checked to determine whether an >> equivalent index already exists," so it is covered. > > Yeah, I'm of two minds about this also -- in the initial versions I had > a code comment wondering exactly about having a hash index in a > partition attached to a btree index on parent. > > As another example, having a documents table with two partitions (one > "long term archival" and other "documents currently being messed with") > you could have a text search index which is GIN in the former and GiST > in the latter. There is a performance argument for doing it that way, > so it's not merely academic. > > Anyway, while I think attaching an index that doesn't match the > properties of the index on parent can be a useful feature, on the other > hand it could be surprising (you end up losing an index because it was > matched during attach that you didn't think was going to be matched). > One idea would be to have a way to specify at ATTACH time what to do > about indexes when they don't match exactly, but I think the user > interface would be pretty messy: exactly how different do you want to > allow the indexes to be? Is an index having one more column than the > one in parent good enough? I think the answer to this is mostly a > judgement call, and I'd rather not spend my time debating those. > Yeah, agreed - lets leave as is. Migrating an index to another type would mean to drop the top-level definition anyway. Best regards, Jesper