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 1pHvw8-0003k2-WB for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jan 2023 00:04: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 1pHvw5-0005Wa-Sp for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jan 2023 00:04:13 +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 1pHvw5-0005RN-IO for pgsql-hackers@lists.postgresql.org; Wed, 18 Jan 2023 00:04:13 +0000 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pHvw2-0003Fy-N2 for pgsql-hackers@lists.postgresql.org; Wed, 18 Jan 2023 00:04:12 +0000 Received: by mail-wm1-x32e.google.com with SMTP id iv8-20020a05600c548800b003db04a0a46bso559880wmb.0 for ; Tue, 17 Jan 2023 16:04:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/Y3UWkdswXHX8+8A3e8iNe/MO+HEf6l7mDNrm9okpN8=; b=ijF8CeoZhsfk0ZCYYhdWMb3//Mxxmu5qvw8oagKc7M0sdH0KD0QmB8PxMB7ME6gJZF 0cdC0cYHtkJyzrgJL0946ocMvNFmT1M+2g1YpfyanFCjDHygrBFD31WlaHCYPDxqQcnL dEtAMYt4QByi/B+5xOXo1iS0brx5Q9Dy0n0R4QNn/XgiZPxJ3VNKtSPjrOxNZ+QtkhHn ak9uayLRI7xvH/uazNTl8VnlckBeAfR+SZWDOI/YCC+WZhOPovJZMaa6XZ3M+Lcw/5Fb 4x233JQEPTH0c/0Hnca8cyic/sEtmf2tHQRdMTs3KMWkg2YJPNY4H+IfsBydwJwABFOy 7BKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/Y3UWkdswXHX8+8A3e8iNe/MO+HEf6l7mDNrm9okpN8=; b=S1MLPRf/pkA2kLNCE2xOQxK/ZPxrKZQGLE6pNW9mBnQXbmVAkvFTDrrjN2Bk/PbwNk JqEFOxmpQm1bqgY3pvRNxQZzz8l7bYxB+YMoTEBmadGh21VMykRHXitCQ5va+VB580pi ODehgZfuLX6tUbzNNkbcfdUZAZS5u4piJ/8wkEZvji0XQrSbXIM2T60wT8+VPvoPLdBJ t2+0Zw6dwf6YG4PncFRQszHRZ4vSf2D/Bg/5+wJyQPHeSXmQCLnA8hOrjoBGC14EtWmn Mj/9jf1zM88CeLQoVnlVCNE7lMM6svNSuRq6Q1PYtF1ehZ9lIuVhC0zQc86WCR2aWmyB oiRA== X-Gm-Message-State: AFqh2koULPeTMq2HX7imqoO9ipu9fzHMGiZLaLdYfvnUpGFzFZhVz6ZQ zNEoQ/arD7Xc4DwanVup7Czr2xF5G7tG0iztLmsYdEyE0ESbqfvmrtnehnhDUtQkDLwkCfuSY3n GwFvnZmt18Ov6M7A9QuZPEPe5v6iW3PxN4G/rMUjUodVUAgfJNsEymT+t4PYEfwGfyUsvL/vDIq J851yIpyD9/ub+csdaN3jWAvoz2q4aYVyjEZI526sLnKLzfr9ueYG1WXPlU1pGLCXCEpq96rZwQ wuqYXRgtGZXj1Of4db0gnTdMvnwT3fDD5eLkK/XqwzQAHHFBgZsZj/WaW3kXvtQ03U2BgOyDg== X-Google-Smtp-Source: AMrXdXv4EWUpTjrbyZU/QWnRDWQdx3CpBByNLgpuj8jIBCX/Z6O+FD64o68j/dvdFHjNTAuMbmEuzA== X-Received: by 2002:a05:600c:4fd3:b0:3cf:7197:e68a with SMTP id o19-20020a05600c4fd300b003cf7197e68amr580275wmq.18.1674000248346; Tue, 17 Jan 2023 16:04:08 -0800 (PST) Received: from [10.137.0.17] (ip-86-49-228-162.bb.vodafone.cz. [86.49.228.162]) by smtp.gmail.com with ESMTPSA id j32-20020a05600c1c2000b003c6b7f5567csm432899wms.0.2023.01.17.16.04.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Jan 2023 16:04:07 -0800 (PST) Message-ID: Date: Wed, 18 Jan 2023 01:04:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: Progress report of CREATE INDEX for nested partitioned tables To: Justin Pryzby Cc: Ilya Gladyshev , pgsql-hackers@lists.postgresql.org References: <039564d234fc3d014c555a7ee98be69a9e724836.camel@gmail.com> <20221217143002.GR1153@telsasoft.com> <20230108164849.GA21731@telsasoft.com> <865a4ff239b6824fd5bbdd4a972390d1e95144b4.camel@gmail.com> <31ee17da-8705-9afc-9451-5374a5e51aff@enterprisedb.com> <20230117205904.GW9837@telsasoft.com> Content-Language: en-US From: Tomas Vondra In-Reply-To: <20230117205904.GW9837@telsasoft.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 1/17/23 21:59, Justin Pryzby wrote: > 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. > Ah, you mean whether it's the right place for the parameter? I don't think it is, really. IndexStmt is meant to be a description of the CREATE INDEX statement, not something that includes info about how it's processed. But it's the only struct we pass to the DefineIndex for child indexes, so the only alternatives I can think of is a global variable and the (existing) param array field. Nevertheless, ABI compatibility is still relevant for backbranches. >> 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. > OK >> 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. > You're right the issue us about overwriting the total - not sure what I was thinking about when writing this. I guess I got distracted by the discussion about "preliminary planning" etc. Sorry for the confusion. > 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. > +1, it was just an idea for future. -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company