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 1pbTpV-0000Va-Fl for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Mar 2023 22:06:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pbTpU-0003Q1-C5 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Mar 2023 22:06:12 +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 1pbTpT-0003Ps-Ry for pgsql-hackers@lists.postgresql.org; Sun, 12 Mar 2023 22:06:12 +0000 Received: from mail-il1-x130.google.com ([2607:f8b0:4864:20::130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pbTpN-0004yj-P5 for pgsql-hackers@lists.postgresql.org; Sun, 12 Mar 2023 22:06:10 +0000 Received: by mail-il1-x130.google.com with SMTP id h5so2058508ile.13 for ; Sun, 12 Mar 2023 15:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1678658765; 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=Ew6Ag8SWUtsZRV2HanTyP5QlNIgb0WJXcbjFFk0SwYE=; b=60l6FZ0lqcD4qfAZvnZwtyK+LYAkxj2oh0O670NOdN5197HNjrQK6ZpzqGPwNQw7K1 7AqXCAa4uGhb2j/INRI/TM5Ppn3oEv0O4G3AuIL2HdniBnJcj+l5eKMpCc7uQt/ONuyI QtrWvbIpskqDdHyMj8CmBJq5kpRvtfn8ObCf70guGNsjjpceEU2DcqPl3e2NHHjOfM+b CvaXFXoD13v2P1r61zfoxebY5eQC9a2tU8Rr0BIHpCK/vyKC3xL1JYBXNQ1r5tED0HV5 aJwGizdLsjwO03PledkQhqoYy1/yJLKgm0+ceUYNIQ3jEtrH6HZxdKrKDa7m3BzFFc9e fJFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678658765; 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=Ew6Ag8SWUtsZRV2HanTyP5QlNIgb0WJXcbjFFk0SwYE=; b=vNp05AXfOK+5uRlx5FubEkcDL3ZKNBiLoR2C+xUP01JxfDmCJwf55JeYLbb+QcX41y o8pEWCb2NFmezhG6jRnz0CxptqZvQsJ83IpgNn0qL5ml4p8HvdZ/2uoJVDs9rhOwBYh+ BQvtIlK5uVpNFzpv2eVdSMwTq7LNhmLYwmO+Nmig+OgA/1LAwFEs8q81lFZvb1pnrPaM WOqkqc4bxZCzsthRGztnXrMhCzNrRJ8wKddrBppPvLDzKPpXmQQG8gS4YyVTSOekt13H CjnVpZRXJfCRnqtBFlcbqAy6qXp8pEEuVpUOS9kUpnr8CfnhwZl/NM/6QVTIbztZrrw8 Njhw== X-Gm-Message-State: AO0yUKU/eQUpSrl944ONHhkf9XTyT/ke/DcWpQ3IlQzchiIDFiuN1MyC ymXo2Ao8M6j5HhEDbVKXl8pH+w== X-Google-Smtp-Source: AK7set+Ivsg3Ib9SqmbQ+OzAwLlVf30DZJxtbnoPkSe15JKqFvPhKmpZ2se3fWuqPvfz+qRjWJoxiQ== X-Received: by 2002:a05:6e02:102d:b0:316:e941:24e3 with SMTP id o13-20020a056e02102d00b00316e94124e3mr10569133ilj.24.1678658764974; Sun, 12 Mar 2023 15:06:04 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id w21-20020a029695000000b0037477c3d04asm1939602jai.130.2023.03.12.15.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 15:06:04 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 7959C802A72; Sun, 12 Mar 2023 17:06:03 -0500 (CDT) Date: Sun, 12 Mar 2023 17:06:03 -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: <20230201155336.GU22427@telsasoft.com> <20230202151807.GY22427@telsasoft.com> <20230208224049.GO1653@telsasoft.com> <20230217002651.GW1653@telsasoft.com> <1000008.1678480570@sss.pgh.pa.us> <1605789.1678652046@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1605789.1678652046@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Mar 12, 2023 at 04:14:06PM -0400, Tom Lane wrote: > Justin Pryzby writes: > > On Fri, Mar 10, 2023 at 03:36:10PM -0500, Tom Lane wrote: > >> I took a look through this. It seems like basically a good solution, > >> but the count_leaf_partitions() function is bothering me, for two > >> reasons: > > > ... find_all_inheritors() will also have been called by > > ProcessUtilitySlow(). Maybe it's sufficient to mention that ? > > Hm. Could we get rid of count_leaf_partitions by doing the work in > ProcessUtilitySlow? Or at least passing that OID list forward instead > of recomputing it? count_leaf_partitions() is called in two places: Once to get PROGRESS_CREATEIDX_PARTITIONS_TOTAL. It'd be easy enough to pass an integer total via IndexStmt (but I think we wanted to avoid adding anything there, since it's not a part of the statement). count_leaf_partitions() is also called for sub-partitions, in the case that a matching "partitioned index" already exists, and the progress report needs to be incremented by the number of leaves for which indexes were ATTACHED. We'd need a mapping from OID => npartitions (or to compile some data structure of all the partitioned partitions). I guess CreateIndex() could call CreatePartitionDirectory(). But it looks like that would be *more* expensive. -- Justin