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 1pc5jN-0008Gd-Lh for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Mar 2023 14:34:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pc5jM-0002vh-Ay for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Mar 2023 14:34:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pc5jL-0002vX-ST for pgsql-hackers@lists.postgresql.org; Tue, 14 Mar 2023 14:34:24 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pc5jI-0005H8-Se for pgsql-hackers@lists.postgresql.org; Tue, 14 Mar 2023 14:34:23 +0000 Received: by mail-il1-x130.google.com with SMTP id h11so3449444ild.11 for ; Tue, 14 Mar 2023 07:34:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1678804458; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=PeAQZ8egH1eJR00xeaP9p6Wk+ZLUy8dDiyKk/tSXh4M=; b=qziOasmZBtTbhuuNu2xlEiqFUZUs2IHInPIVxK2hbIvv6WRmgs4jBRJZZjYik/+5sw 8dJ6daL/NARDSGim4uW/+OHwq4p/c43SiDityIIvv+XCBjHtftdp4PGqQLEIf5ltu5l5 iWE2Y0LYkb1X4ODinkJNtKuYSP43SNn0NCQYeGSl4xjUzVvHgp4md2Dn/6FuO1tsCQMz 6u9WeRkg7DSuDDWx5zZPQigaVixQwW9Vym0NYrN6YGs+jeqto35k1IZ7UN8lQ4cqalAX PMJWzJ+kCngT2BPTKM4D8BKcywn9+lMvr4skirHfuX+KV61+SatRc3RyvrZWgI17E1wG 4YqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678804458; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=PeAQZ8egH1eJR00xeaP9p6Wk+ZLUy8dDiyKk/tSXh4M=; b=JHut9IlOjk1g5n7F1uF9ISB+WQ6wkpDKKzKyxWII/Ab8S/68h5kuBjYXPZ/HneiFoC WglifF/+gaayOMoGDcfvPUVSaCnHbyj7C4fUE487g465+zF4YeUiF9aQAumhdVUWdK9l LgO375m2k2Vb/rLSTbnuXQx5pWpwLVnCGwP0qKBseo+Huuz+hlAYjTAiA5bfC6JD73/7 cgVX+yelXN5W1n70U+LPck00wi4NCrMw+RDSO1XdoFtzNGjZSagc+t2OqVyTQ/JGtcos /Ibo/8Sm/LaVYCNobq3U43AQC+JrM41ek/a6SpWY5/NOhp2HrVVr2jaJAcBLVZUw98ci n8TA== X-Gm-Message-State: AO0yUKUaShvLlPBdIm1OMEbfyzOHcGMi83tSpeIVO5eKejhcDOtbrJh+ 0SEfpRfRtWrWdknnKiwUa9AaVw== X-Google-Smtp-Source: AK7set/8rqo4QfPthTVnEDwb1jT+0n8Ct+tv3hUA1S1wi3iQEHLeztpjA6+scVGVtqsPmgWAVk24jw== X-Received: by 2002:a92:dac7:0:b0:318:8674:bf3 with SMTP id o7-20020a92dac7000000b0031886740bf3mr2392852ilq.19.1678804458800; Tue, 14 Mar 2023 07:34:18 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id i17-20020a02cc51000000b003aef8fded9asm814452jaq.127.2023.03.14.07.34.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 07:34:18 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 059E4800ACE; Tue, 14 Mar 2023 09:34:16 -0500 (CDT) Date: Tue, 14 Mar 2023 09:34:16 -0500 From: Justin Pryzby To: Tom Lane Cc: Matthias van de Meent , Ilya Gladyshev , Alvaro Herrera , Tomas Vondra , pgsql-hackers@lists.postgresql.org Subject: Re: Progress report of CREATE INDEX for nested partitioned tables Message-ID: References: <20230208224049.GO1653@telsasoft.com> <20230217002651.GW1653@telsasoft.com> <1000008.1678480570@sss.pgh.pa.us> <1605789.1678652046@sss.pgh.pa.us> <1621054.1678659913@sss.pgh.pa.us> <1634535.1678666528@sss.pgh.pa.us> <1760574.1678718579@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1760574.1678718579@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Mar 13, 2023 at 10:42:59AM -0400, Tom Lane wrote: > Justin Pryzby writes: > > On Sun, Mar 12, 2023 at 06:25:13PM -0400, Tom Lane wrote: > >> I agree that adding such a field to IndexStmt would be a very bad idea. > >> However, adding another parameter to DefineIndex doesn't seem like a > >> problem. > > > It's a problem since this is a bug and it's desirable to backpatch a > > fix, right ? > > I do not think this is important enough to justify a back-patch. That's fine with me, but it comes as a surprise, and it might invalidate earlier discussions, which were working under the constraint of maintaining a compatible ABI. > > Incrementing by 0 sounds terrible, since someone who has intermediate > > partitioned tables is likely to always see 0% done. > > How so? The counter will increase after there's some actual work done, > ie building an index. If there's no indexes to build then it hardly > matters, because the command will complete in very little time. I misunderstood your idea as suggesting to skip progress reporting for *every* intermediate partitioned index, and its leaves. But I guess what you meant is to skip progress reporting when ATTACHing an intermediate partitioned index. That seems okay, since 1) intermediate partitioned tables are probably rare, and 2) ATTACH is fast, so the effect is indistinguisable from querying the progress report a few moments later. The idea would be for: 1) TOTAL to show the number of direct and indirect leaf partitions; 2) update progress while building direct or indirect indexes; 3) ATTACHing intermediate partitioned tables to increment by 0; 4) ATTACHing a direct child should continue to increment by 1, since that common case already works as expected and shouldn't be changed. The only change from the current patch is (3). (1) still calls count_leaf_partitions(), but only once. I'd prefer that to rearranging the progress reporting to set the TOTAL in ProcessUtilitySlow(). -- Justin