Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vGXgx-0003Q9-UQ for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Nov 2025 07:12:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vGXgw-000qRz-Ob for pgsql-hackers@arkaria.postgresql.org; Wed, 05 Nov 2025 07:12:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vGXgw-000qRp-CR for pgsql-hackers@lists.postgresql.org; Wed, 05 Nov 2025 07:12:25 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vGXgt-005Xbp-1X for pgsql-hackers@lists.postgresql.org; Wed, 05 Nov 2025 07:12:24 +0000 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-640c1fda178so4561643a12.1 for ; Tue, 04 Nov 2025 23:12:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1762326740; x=1762931540; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MuCVkrvL3JnV1hR3Z52z7msdsI7aOBQBQ+VsBomwEKg=; b=kOv5P9SoXn49efsTlymBkyAryIuo47GC9enb9xwXp/CzxSnbnmaPb2bUxVcqMIaeUr Bqqju20F7rkB1qpgpMBWwhHUqZzPIJWS4Z/NGsYKDy0jnAlaTRBulg0uJq/HfpL1i6C0 7Hl6g505J8zIVAh+fYB73/MxYsYcObSkv08K9S5rUJNYBTUjhov0p7fReuL8MqqGiT7l 6yUB0PNGe9mfsHuFJf/9ZGDn5+zxW3BX05Na/EJj/lO9OKuZpVxc+RC7kuDL0J2CH7Gu UhXd16M3dx5h/oTm5gVsNIQeFUVvY6kERr3GSbQ1Dz8QAdz/Y7kq1DSAP90pwiqWeRxC TNhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762326740; x=1762931540; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MuCVkrvL3JnV1hR3Z52z7msdsI7aOBQBQ+VsBomwEKg=; b=R6C4LBiE5EraFhcN3btferW3+a3ekgyHrzGGkzuroS2KWZAAg+xTvV857GYTnFcKda /A6P9G7m+SGYS2mhRrY4b78BeYK2VhiEizOTs7SH0jsrP5ZLOubFEkOPW3Ww3KkCiBJR 8e7BPbDLgie99bQj3+JiTb/rzHpslg+smx3XWTic41n49MlJ1ZK1yd3y+TVcwqt6I1Os YThvmSJCxaDmcT4LRbPLrjSGRhdUhULms0DpBwgPmUAmVzm3dfYpGhieNP0vno5pqtAT +C+2g+2wYluuRs+C36f94+6QEMuCp21+OlvAqs1U6mg35Y+/Z8yEjcyF2t1cEldLx366 lRSA== X-Forwarded-Encrypted: i=1; AJvYcCV2KRMekWV8cGE6hPwqTMwvbpyNQVEZYCyxXLyUJZOaHRtAkMC8VsBYSDT0N11APu2zBiYjNgCpJmp/8Vhv@lists.postgresql.org X-Gm-Message-State: AOJu0YwltAv9zeeXg3BW7l/OHR6Ls6scuKJw6nstxQVbKnSm58jNyGFs g32WnB+Y+kGnThkKKV/wjg3n/AxjcPU1xuSdEiinDERtu8n7B9W2BV/z4ETB8yiIYDY= X-Gm-Gg: ASbGncv7bHKi523p/ju48tweaLQNlBUhN1SYh4j4jSnjVUc45R/iWLZWkQaWxOLHBSX 05QF+kldnEzN5eyyqBHzdqsd5zppokBSceMOy31prOehtFuofNKEb8Ao1ELpPbBimfcpEyFjyHY Z06PmUKqusFpp+odZQoVx5DNf6D11PUKcvYlqXOTnuSijAUWJMmXXrXFyJKoaUGjDLOoFEI3OSI kySap7pBhZcQ+PxROAgornHddGGNlF2WnoN2/FxxS00vXFsfCwdhem96TSqAD2gbLKy/q2ZVJr8 yQAQia2PaXusCUWTqdyYWBF9Yn0NX84oQcIiuDgTwM+kFRMErIYcOp3iGR6KW/BLe8UtShR97GR 7KQvS6z7xms+0djUH3PyWexi8UiTvFUohF67kV0MRp7zQkbzBis7kZy7kN4GXAoE9INz1BksN+A 6oR5JwZL1XC1oR4w== X-Google-Smtp-Source: AGHT+IF1YWh1Cvdytq0ZxxViUla6pnOhvRGfYRGYxl61nZawd8IT4UE+0ZaMzshtaJl6XMvXvwNN8A== X-Received: by 2002:a17:907:3c96:b0:b0f:4ae:c83 with SMTP id a640c23a62f3a-b72656c002fmr226341866b.63.1762326740224; Tue, 04 Nov 2025 23:12:20 -0800 (PST) Received: from localhost (109-81-168-246.rct.o2.cz. [109.81.168.246]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b7240348d93sm401221366b.68.2025.11.04.23.12.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Nov 2025 23:12:19 -0800 (PST) From: Antonin Houska To: Robert Treat cc: jian he , Alvaro Herrera , Pg Hackers , Mihail Nikalayeu Subject: Re: Adding REPACK [concurrently] In-reply-to: References: <202507262156.sb455angijk6@alvherre.pgsql> <202510301734.pj4uds3mqxx4@alvherre.pgsql> Comments: In-reply-to Robert Treat message dated "Wed, 05 Nov 2025 00:10:47 -0500." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 05 Nov 2025 08:12:19 +0100 Message-ID: <7224.1762326739@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Treat wrote: > On Tue, Nov 4, 2025 at 9:48=E2=80=AFPM jian he wrote: > > what the expectation of > > pg_repackdb --index=3Dindex_name, the doc is not very helpful. > > > > pg_repackdb --analyze --index=3Dzz --verbose > > pg_repackdb: repacking database "src3" > > pg_repackdb: error: processing of database "src3" failed: ERROR: "zz" > > is not an index for table "tenk1" > > > > select pg_get_indexdef ('zz'::regclass); > > pg_get_indexdef > > --------------------------------------------------- > > CREATE INDEX zz ON public.tenk2 USING btree (two) > > >=20 > Hmm... yes, this is a bit confusing. I didn't verify it in the code, > but from memory I think the --index option is meant to be used only in > conjunction with --table, in which case it would repack the table > using the specified index. I could be overlooking something though. The corresponding code is: + /* + * In REPACK mode, if the 'using_index' option was given but no index + * name, filter only tables that have an index with indisclustered set. + * (If an index name is given, we trust the user to pass a reasonable list + * of tables.) + * + * XXX it may be worth printing an error if an index name is given with no + * list of tables. + */ + if (vacopts->mode =3D=3D MODE_REPACK && + vacopts->using_index && !vacopts->indexname) + { + appendPQExpBufferStr(&catalog_query, + " AND EXISTS (SELECT 1 FROM pg_catalog.pg_index\n" + " WHERE indrelid =3D c.oid AND indisclustered)\n"); + } I'm not sure if it's worth allowing the --index option to have an argument. Since the user can specify multiple tables, he should also be able to specify multiple indexes. And then the question would be: what should happen if the user forgot to specify (or just mistyped) the index name for a table which does not yet have the clustering index set? Skip that table (and print out a warning)? Or consider it an error? --=20 Antonin Houska Web: https://www.cybertec-postgresql.com