Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1j7s4x-0005L5-Lg for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Feb 2020 02:42:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j7s4w-0004dc-Dw for pgsql-hackers@arkaria.postgresql.org; Sat, 29 Feb 2020 02:42:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j7s4v-0004dV-Td for pgsql-hackers@lists.postgresql.org; Sat, 29 Feb 2020 02:42:10 +0000 Received: from mail-yw1-xc41.google.com ([2607:f8b0:4864:20::c41]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j7s4s-0001if-D6 for pgsql-hackers@postgresql.org; Sat, 29 Feb 2020 02:42:08 +0000 Received: by mail-yw1-xc41.google.com with SMTP id n1so4832056ywe.13 for ; Fri, 28 Feb 2020 18:42:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hJIAwabYJNkbijjvDDvF33JOdkjphsUUHC1h3vjhT6k=; b=JYLROP7xCdNdcweI7x2Qq/kseXWhktC14ZhUGVEjWibN1o2b2YEuZGUVJCGh+CPMQn UUp2p5YHwneSSYmFvTgCGs56/Ia/MmJj5fVxuUjcRsd1q8eG/EhzSTdAxHh9NBy1BWGR 5EzVlfStLkNmhSJhMdPP2EApPqSVUdMTS1DuIF3xzB138JVB8sebuoSX5BunaJVZz+IV ightAh11c5eHF8lKtI0YdHSd9+TYlvv6CskRDeVWMVsVXTELCY3zuuEc/TFXOGgeoumR tQUGTjqykXm/MjOZ1V4O81E8tnvnSeZVGeVBZ7AuIQRwtgJyV1bLhOEa0mZ9o0lrIABa +SHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hJIAwabYJNkbijjvDDvF33JOdkjphsUUHC1h3vjhT6k=; b=dqv/IwbmChFvcSHJCdgkmc2VTqYPutl5nD8J/57rnpEcv95paiEOU2d9KXoC6Girm6 ZuJmEKIDKVWKKN9RIdvNhJFLA0BE63CJj1A6P6luJk8TcUJv0Z8D4iiT7oSI1pD+Jovs PUBxOLnEbJsNVPubLFJEH9QaO0PzwKIL4d5qBZmUv7yYuPu1TO6oI+6kF5B+9ExJdHqh mV7Zx9qXuQmbRl2Xa+dE/ymL3E3hTciwCZT+QoE8Rjmjj32TXlkCz3RgpyY/eCqnOKea jSl9q/P/gqNLt4Mkb5DOrdc5tgiPZ/phEXZe2Wz4YKIAC0B7oHgaWuTKPe23gYqmwMM2 +Kdg== X-Gm-Message-State: APjAAAV0J3PkHNCQYR5WeR/bcMPQhq5yZ5cOhLWEI6aPCmIjCLg+lB0Z MDvM8oozM/G8tbofyEco1hAwdg== X-Google-Smtp-Source: APXvYqwTwph+uaTIG2/zTaAmXiiF3fI//f5BHBP4XAxuRrjnxZuCQY4zQcHUzo3JmcUZEsZQYgx7AQ== X-Received: by 2002:a25:2146:: with SMTP id h67mr6347868ybh.92.1582944125488; Fri, 28 Feb 2020 18:42:05 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id n39sm5147087ywh.45.2020.02.28.18.42.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Feb 2020 18:42:04 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id 10A14800C8E; Fri, 28 Feb 2020 20:42:03 -0600 (CST) Date: Fri, 28 Feb 2020 20:42:02 -0600 From: Justin Pryzby To: Tom Lane Cc: Alvaro Herrera , Amit Langote , pgsql-hackers@postgresql.org, Michael Paquier Subject: Re: ALTER tbl rewrite loses CLUSTER ON index Message-ID: <20200229024202.GH29456@telsasoft.com> References: <20200206144426.GH403@telsasoft.com> <20200206172447.GA28041@alvherre.pgsql> <20200207143935.GP403@telsasoft.com> <17937.1582932364@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17937.1582932364@sss.pgh.pa.us> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Feb 28, 2020 at 06:26:04PM -0500, Tom Lane wrote: > Justin Pryzby writes: > > I think the attached is 80% complete (I didn't touch pg_dump). > > One objection to this change would be that all relations (including indices) > > end up with relclustered fields, and pg_index already has a number of bools, so > > it's not like this one bool is wasting a byte. > > I think relisclustered was a's clever way of avoiding that overhead (c0ad5953). > > So I would be -0.5 on moving it to pg_class.. > > But I think 0001 and 0002 are worthy. Maybe the test in 0002 should live > > somewhere else. > > 0001 has been superseded by events (faade5d4c), so the cfbot is choking > on that one's failure to apply, and not testing any further. Please > repost without 0001 so that we can get this testing again. I've just noticed while working on (1) that this separately affects REINDEX CONCURRENTLY, which would be a new bug in v12. Without CONCURRENTLY there's no issue. I guess we need a separate patch for that case. (1) https://commitfest.postgresql.org/27/2269/ The ALTER bug goes back further and its fix should be a kept separate. postgres=# DROP TABLE tt; CREATE TABLE tt(i int unique); CLUSTER tt USING tt_i_key; CLUSTER tt; REINDEX INDEX tt_i_key; CLUSTER tt; DROP TABLE CREATE TABLE CLUSTER CLUSTER REINDEX CLUSTER postgres=# DROP TABLE tt; CREATE TABLE tt(i int unique); CLUSTER tt USING tt_i_key; CLUSTER tt; REINDEX INDEX CONCURRENTLY tt_i_key; CLUSTER tt; DROP TABLE CREATE TABLE CLUSTER CLUSTER REINDEX ERROR: there is no previously clustered index for table "tt" -- Justin