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.89) (envelope-from ) id 1izktb-00049h-7y for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Feb 2020 17:24:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1izktZ-0005eu-TL for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Feb 2020 17:24:53 +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 1izktZ-0005d6-GU for pgsql-hackers@lists.postgresql.org; Thu, 06 Feb 2020 17:24:53 +0000 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1izktW-0003ul-QO for pgsql-hackers@postgresql.org; Thu, 06 Feb 2020 17:24:51 +0000 Received: by mail-qv1-xf42.google.com with SMTP id dp13so3215758qvb.7 for ; Thu, 06 Feb 2020 09:24:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Q371WF8iBUhy/+P2kwLiZn7VYZ+TE8xNwXHsskeT/0w=; b=QtWWubAE0OrNFIheb1hI4kyk3TjEGdjpm/vWHH+yu+OSAzpf2yw0OiR+qmvVWTOsUB VVah/mvXP0ddoO5YWKpyRWLLdXQLIPE9Z5jeKCcT6xdVNMV4aN7zrzisvAIVFoO7pm9c Kqh0Jnno+Unm5ZM1dOd86qMFyv5igyAsXnVX7JgnIWBwiwb+mLiAhEp6bPWCR95ru9KL h6mCjveeje0sWhzdocW4h69xRk+ae8Z9jrQ03Vi5f95264/SstsSSH/B4db/ZDwKcCh1 KxzeIN/DE25q4YFL0rVOl4ssOjumkxI+y6ykuQVx4cN2oniektljlEMcsxmg9jSpbPc+ ussA== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Q371WF8iBUhy/+P2kwLiZn7VYZ+TE8xNwXHsskeT/0w=; b=kkXhfbmKWZwb28rMLEVaikxByZQ0z+91bPrv0uD2fbNQlWUQrDIxSg2O6HrYkhrLAp I4iU6GMdiA3GB4ZByz3Rut3sCbVCp3JZ3E/Vybn8XwFb8mGBCJ5K3PMwcO25PrMWHJDp TAlpSzdsT+KjDn28EiF3LYE50fi64xe32boW5ZKks8KZ+oplYxfXzmEOHO6GRBCrqGcf 04v3N50icqkaXJ933ZPDkAwCKXgT0LzvTd9/NrklKZuuk6utUzS15Edv0wiyz+eFZcvF xIPgqNYS+XVIk71CqbBHu7SDTIHLeLzWy7wZsM2Yz6RpzT/Fuy87U35V9MAtx2BJTYWf SOIQ== X-Gm-Message-State: APjAAAXCKFpO56JvFfsWgksGfXFap2pORDUSEc1yKWjBqO1EwjaBkZlK uT6thLfKxutUnXgBHJDqiyxa2g== X-Google-Smtp-Source: APXvYqxAj2mQQ+psHBETvCOmbNVP50UuzP5hGsJZXcfUpsh1OEOdt+lK/kbjQYOWWa2WOGSMRWzclw== X-Received: by 2002:ad4:4e34:: with SMTP id dm20mr3340796qvb.163.1581009890021; Thu, 06 Feb 2020 09:24:50 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([201.186.208.119]) by smtp.gmail.com with ESMTPSA id x11sm1725115qkf.50.2020.02.06.09.24.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2020 09:24:49 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 36EE330081F; Thu, 6 Feb 2020 14:24:47 -0300 (-03) Date: Thu, 6 Feb 2020 14:24:47 -0300 From: Alvaro Herrera To: Justin Pryzby Cc: Amit Langote , pgsql-hackers@postgresql.org Subject: Re: ALTER tbl rewrite loses CLUSTER ON index Message-ID: <20200206172447.GA28041@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200206144426.GH403@telsasoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Feb-06, Justin Pryzby wrote: > I wondered if it wouldn't be better if CLUSTER ON was stored in pg_class as the > Oid of a clustered index, rather than a boolean in pg_index. Maybe. Do you want to try a patch? > That likely would've avoided (or at least exposed) this issue. > And avoids the possibility of having two indices marked as "clustered". > These would be more trivial: > mark_index_clustered > /* We need to find the index that has indisclustered set. */ You need to be careful when dropping the index ... -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services