Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz5QS-0004Vf-Rq for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Jan 2021 22:12:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kz5QP-00016J-Qf for pgsql-bugs@arkaria.postgresql.org; Mon, 11 Jan 2021 22:12:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz5QP-00016B-GL for pgsql-bugs@lists.postgresql.org; Mon, 11 Jan 2021 22:12:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kz5QN-0001Mv-9c for pgsql-bugs@lists.postgresql.org; Mon, 11 Jan 2021 22:12:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 10BMCRPs1038257; Mon, 11 Jan 2021 17:12:27 -0500 From: Tom Lane To: Alvaro Herrera cc: boekewurm+postgres@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16818: progress reporting ALTER TABLE ADD UNIQUE In-reply-to: <20210111211313.GA25789@alvherre.pgsql> References: <20210111211313.GA25789@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Mon, 11 Jan 2021 18:13:13 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1038255.1610403147.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 11 Jan 2021 17:12:27 -0500 Message-ID: <1038256.1610403147@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2021-Jan-11, PG Bug reporting form wrote: >> The progress reprorting for `ALTER TABLE test ADD UNIQUE (col)` is in >> `pg_stat_progress_create_index`. As it indeed creates an index, that is= not >> too unexpected, but the `command` column of that view reports `CREATE >> INDEX`, and _that_ is somewhat unexpected. A reasonable expectation wou= ld be >> `ALTER TABLE ADD CONSTRAINT` or comparable. = > Hmm, seems a reasonable complaint. Are there other command wordings > that would need to be handled? I can't think of any (but I already > overlooked this one, evidently ...) TBH, I think that reporting it as "CREATE INDEX" is good, and what the OP is asking for is less good. Creating an index is what is actually the time-consuming step here --- making the catalog entries for the constraint is negligible. Also, just how picky would we be about replicating the command spelling -- e.g., consider "ALTER TABLE t ADD PRIMARY KEY(p)" vs "ALTER TABLE t ADD CONSTRAINT c PRIMARY KEY(p)" vs "ALTER TABLE t ADD COLUMN c int PRIMARY KEY" vs all the same options for UNIQUE vs all the same options for EXCLUSION vs yadda yadda. That is not going to be helpful to anybody, IMO, especially not automated tools that might be watching the progress view. It's reasonable for the view to distinguish REINDEX and CONCURRENTLY options, as those are relevant to performance, but I don't think we should add purely-cosmetic variations. regards, tom lane