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 1pg6sL-0003BM-20 for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2023 16:36:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pg6sJ-0007u8-2l for pgsql-hackers@arkaria.postgresql.org; Sat, 25 Mar 2023 16:36:15 +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 1pg6sI-0007ty-Fs for pgsql-hackers@lists.postgresql.org; Sat, 25 Mar 2023 16:36:14 +0000 Received: from mail-io1-xd32.google.com ([2607:f8b0:4864:20::d32]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pg6sF-00013Y-3q for pgsql-hackers@lists.postgresql.org; Sat, 25 Mar 2023 16:36:13 +0000 Received: by mail-io1-xd32.google.com with SMTP id f14so2092580iow.5 for ; Sat, 25 Mar 2023 09:36:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1679762170; 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=V3XtqhtDBhTeocuicxiQgDaVhMZBlpMQmZfR1zjswNs=; b=rAk62unNEBuC3oBmqqT6fdzvhox10c6Pr81gXiZ/D77tPuYOgmUDM3Nj1glfsFxhMj TuWEpq16Y6pWlAN7ph5BzFMzTqYzt1Z8MEjbs1QbrHdquGp6WaWkxoKUeVuHpbhaE3UL c3I4ETX6n8EixUsVJhplr8wTf11LvQlM5dYoq2BL67fcAV63aGX0L5sUI2jYSqu3zkXd NLhUnk0yhkpHi5CUXaCKiKP045d7H+BafY8qr/3HibfpL5Z7Na5unf3DctSLid7FXRxw X9Nsg47LGjyrIipyAGULapVu3JDYMgdS3KnuqJssRQbaqkx5iQ0yb0juljx90s4qgluV XYbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679762170; 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=V3XtqhtDBhTeocuicxiQgDaVhMZBlpMQmZfR1zjswNs=; b=jg5NBDtoGAB1/xtsVgRgjVki2THIyXwSV5bMimOyJDyvjr3a2Mph2cKQ0k2sEWXWUW iwDW4hTo7yUgE7HFkvpZfMVoONIhevEN0WwFnOHVCKqc2z63k95V5rpLHQdcaos9p/3E 0yGD2UwL69OugcFNpS3s8BwgsXlX0B1ibJ2sMA6QjeRYlqIwIlbZBdmPrfV6ktYbdUK6 TLLB1tmgEicTPVBkgdM2RwaJtrsYm4nOhEFuhg6LsHe+Tr80DAu52Rg/LTAz8VDH6LLa l+tkvwquSb6cacWZXPIUlVE54FShBdqKy3ih88Pnnu/Gk5CMVNTiI25IPqQEPbEuvXMf sluw== X-Gm-Message-State: AAQBX9ePZH25fD2p2j/XYOqCLDm8jane0GgNp2PWVd/A56PtUp72D4z5 vrb8/sDazWy15mHzvseuCBUGOA== X-Google-Smtp-Source: AKy350a/kDVbR8UCCyYvDX2ULpFLY44IyB4yXoMDJbhZiPNoxm5VeiRnkdVWYXY6o76BBMRM8awr/g== X-Received: by 2002:a6b:cd8e:0:b0:759:a0f8:af08 with SMTP id d136-20020a6bcd8e000000b00759a0f8af08mr905224iog.8.1679762170237; Sat, 25 Mar 2023 09:36:10 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id w188-20020a025dc5000000b003a951542b10sm7636185jaa.60.2023.03.25.09.36.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 09:36:09 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 4C943800676; Sat, 25 Mar 2023 11:36:08 -0500 (CDT) Date: Sat, 25 Mar 2023 11:36:08 -0500 From: Justin Pryzby To: Tom Lane Cc: Ilya Gladyshev , Matthias van de Meent , Alvaro Herrera , Tomas Vondra , pgsql-hackers@lists.postgresql.org Subject: Re: Progress report of CREATE INDEX for nested partitioned tables Message-ID: References: <1760574.1678718579@sss.pgh.pa.us> <34FE3024-5025-46B7-B435-8DDD59072705@gmail.com> <266AAEDA-786B-4DDB-B115-AE8EF0E5F283@gmail.com> <2003807.1679603746@sss.pgh.pa.us> <2586913.1679759713@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2586913.1679759713@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Mar 25, 2023 at 11:55:13AM -0400, Tom Lane wrote: > Justin Pryzby writes: > > On Thu, Mar 23, 2023 at 04:35:46PM -0400, Tom Lane wrote: > >> Furthermore, as things stand it's not hard > >> for PARTITIONS_TOTAL to be zero --- there's at least one such case > >> in the regression tests --- and that seems just weird to me. > > > I don't know why it'd seem weird. postgres doesn't create partitions > > automatically, so by default there are none. If we create a table but > > never load any data, it'll have no partitions. > > My problem with it is that it's not clear how to tell "no partitioned > index creation in progress" from "partitioned index creation in progress, > but total = 0". Maybe there's some out-of-band way to tell that in the > stats reporting system, but still it's a weird corner case. > > > Also, the TOTAL=0 case > > won't go away just because we start counting intermediate partitions. > > That's why I wanted list_length() not list_length() - 1. We are > doing *something* at the top partitioned table, it just doesn't > involve a table scan, so I don't find this totally unreasonable. > If you agree we are doing work at intermediate partitioned tables, > how are we not doing work at the top one? What you're proposing would redefine the meaning of PARTITIONS_DONE/TOTAL, even in the absence of intermediate partitioned tables. Which might be okay, but the scope of this thread/patch was to fix the behavior involving intermediate partitioned tables. It's somewhat weird to me that find_all_inheritors(rel) returns the rel itself. But it's an internal function, and evidently that's what's needed/desirable to do, so that's fine. However, "PARTITIONS_TOTAL" has a certain user-facing definition, and "Number of partitions" is easier to explain than "Number of partitions plus the rel itself", and IMO an easier definition is a better one. Your complaint seems similar to something I've said a few times before: it's weird to expose macroscopic progress reporting of partitioned tables in the same view and in the same *row* as microscopic progress of its partitions. But changing that is a job for another patch. I won't be opposed to it if someone were to propose a patch to remove partitions_{done,total}. See also: https://www.postgresql.org/message-id/flat/YCy5ZMt8xAyoOMmv%40paquier.xyz#b20d1be226a93dacd3fd40b402315105 -- Justin