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 1pHt32-0000rP-HY for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 20:59:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pHt31-0002H6-9z for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jan 2023 20:59:11 +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 1pHt30-0002Gx-TS for pgsql-hackers@lists.postgresql.org; Tue, 17 Jan 2023 20:59:11 +0000 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pHt2y-0000SK-CF for pgsql-hackers@lists.postgresql.org; Tue, 17 Jan 2023 20:59:10 +0000 Received: by mail-il1-x132.google.com with SMTP id i17so11209747ila.9 for ; Tue, 17 Jan 2023 12:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=user-agent: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=RVIHbX3QznJLgtdMxvoQTf5F9tr233wVY8qbymNdh8s=; b=bCI1Pwm6OAtprpBrN5jqvRikJ0xdDu8ViulzfvJ0osrF49eZ4p2xzEwvYPwQCRrQce Sq0am1qtb83ifvf4B2Q9IjD7sawPg6XHdNYJ5I4HTqwT7HGcUeENSdfL0yKaIr6+QZLz mY00Kg1/LYLEczCim9UMd47CQWSNig6rkWRRjNtO9x2Khns4g95t1BlDGCypYH2XVh+S RF7jUnlRMHm5ac7QA4PaEO3tRnfuDghXG4aefRRWgeAUKXu1eegRJ4IKvkINsdVfbCXE Sa/Gm3ylqBP3UaIiWI+qEoyvorqha2nMP9B+6fYEmCRljjiTdQguviJi6tfyZfCUQ7Gk w8pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent: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=RVIHbX3QznJLgtdMxvoQTf5F9tr233wVY8qbymNdh8s=; b=zVEg2Tgqbg25SLObEfnh0MwvS5hbVh94jmEvtqsXuSD507iw9CqDMKWm0uYhHYjumD A0BiLHY33fbiXmQ/v7Ygk4Nqz8Oz2bhTDH84xfYZwe9x6Hs3Ud7FL1jKwUv9d/BkcbZu odejZlkEnDCilXfYvYkroW6T7dOkWOrxmp7KKdG18hrm2QNxPX6uLEIHUsegtExvBi62 X1Blv2MGCEIULpyEpchZzW2ILC/lTaZtUz51VkGBTjT7HqqcoJJV6yFzHJEhCPwsQwIG F3RZyPXt6dqjbxYTc+GtcHPHLb/Lo/2AwMj4Eik58zvmqisiV+97y3UNRdkXsZc8CFH0 4tWg== X-Gm-Message-State: AFqh2krsMZyKOQHPai1KxjGuUcJG+czlEHBACn9ud73qxn2zM4RM/5sY 5L5i985J7Hof20FLew/1dr1YzA== X-Google-Smtp-Source: AMrXdXscMQh+Y2mMWd84BID4BzaKlI9Euacbrmoti5A1m7tuVGZArWvH471jobxI0bkuF1aMkUvdCw== X-Received: by 2002:a05:6e02:1d86:b0:30d:c671:48c5 with SMTP id h6-20020a056e021d8600b0030dc67148c5mr5104009ila.16.1673989146196; Tue, 17 Jan 2023 12:59:06 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id 125-20020a021d83000000b0039c492ae300sm9711024jaj.114.2023.01.17.12.59.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 12:59:05 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 7743280074A; Tue, 17 Jan 2023 14:59:04 -0600 (CST) Date: Tue, 17 Jan 2023 14:59:04 -0600 From: Justin Pryzby To: Tomas Vondra Cc: Ilya Gladyshev , pgsql-hackers@lists.postgresql.org Subject: Re: Progress report of CREATE INDEX for nested partitioned tables Message-ID: <20230117205904.GW9837@telsasoft.com> References: <039564d234fc3d014c555a7ee98be69a9e724836.camel@gmail.com> <20221217143002.GR1153@telsasoft.com> <20230108164849.GA21731@telsasoft.com> <865a4ff239b6824fd5bbdd4a972390d1e95144b4.camel@gmail.com> <31ee17da-8705-9afc-9451-5374a5e51aff@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31ee17da-8705-9afc-9451-5374a5e51aff@enterprisedb.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Jan 17, 2023 at 08:44:36PM +0100, Tomas Vondra wrote: > On 1/9/23 09:44, Ilya Gladyshev wrote: > > On Sun, 2023-01-08 at 10:48 -0600, Justin Pryzby wrote: > >> On Sat, Dec 17, 2022 at 08:30:02AM -0600, Justin Pryzby wrote: > >>> ... > >>> > >>> @committers: Is it okay to add nparts_done to IndexStmt ? > >> > >> Any hint about this ? > >> > > AFAIK fields added at the end of a struct is seen as acceptable from the > ABI point of view. It's not risk-free, but we did that multiple times > when fixing bugs, IIRC. My question isn't whether it's okay to add a field at the end of a struct in general, but rather whether it's acceptable to add this field at the end of this struct, and not because it's unsafe to do in a minor release, but whether someone is going to say that it's an abuse of the data structure. > Do we actually need the new parts_done field? I mean, we already do > track the value - at PROGRESS_CREATEIDX_PARTITIONS_DONE index in the > st_progress_param array. Can't we simply read it from there? Then we > would not have ABI issues with the new field added to IndexStmt. Good idea to try. > As for the earlier discussion about the "correct" behavior for leaf vs. > non-leaf partitions and whether to calculate partitions in advance: > > * I agree it's desirable to count partitions in advance, instead of > adding incrementally. The view is meant to provide "overview" of the > CREATE INDEX progress, and imagine you get > > partitions_total partitions_done > 10 9 > > so that you believe you're ~90% done. But then it jumps to the next > child and now you get > > partitions_total partitions_done > 20 10 > > which makes the view a bit useless for it's primary purpose, IMHO. To be clear, that's the current, buggy behavior, and this thread is about fixing it. The proposed patches all ought to avoid that. But the bug isn't caused by not "calculating partitions in advance". Rather, the issue is that currently, the "total" is overwritten while recursing. That's a separate question from whether indirect partitions are counted or not. > I wonder if we could improve this to track the size of partitions for > total/done? That'd make leaf/non-leaf distinction unnecessary, because > non-leaf partitions have size 0. Maybe, but it's out of scope for this patch. Thanks for looking. -- Justin