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 1pbS18-0003d3-Ag for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Mar 2023 20:10:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pbS17-0006XJ-9H for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Mar 2023 20:10:05 +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 1pbS16-0006XA-WA for pgsql-hackers@lists.postgresql.org; Sun, 12 Mar 2023 20:10:04 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pbS12-0005zv-Pm for pgsql-hackers@lists.postgresql.org; Sun, 12 Mar 2023 20:10:04 +0000 Received: by mail-il1-x129.google.com with SMTP id r4so27156ilt.8 for ; Sun, 12 Mar 2023 13:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; t=1678651798; 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=hlhMg3PiA1E75zYTrI73iLr7BBbOs7ZtVO428yMOjFM=; b=4a50UnUoil25IGQLf8grMNql169lu/5nnSocEbcIxRhvjgOf8gTGj2EH5Aj2BUJLOC y/5/g2xZ55iSrkbyOB5wGTgyngUp2/MZ4X8wikwXICanSADls3Ej0kQ8JT6vGJx5QOc4 wGYzsHtIsWKW0XncQ4zqJHigfcYWm6uz4LtHoDY5kmxiu16IRtZI1n3Jc57ni6tILcHw fPZvOVrwbRhG4tgg13G3+xlCwfORRGiJAoBpcZdKa+d5blaTm4g5TJRRnV7h6YiTu9+t McyUxPJa7tlTUJbc496NkLk1TaYGOIGKsjKRIu5xA24ccTGd2rOrdnftk2DodKZ4gS1F 0bmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678651798; 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=hlhMg3PiA1E75zYTrI73iLr7BBbOs7ZtVO428yMOjFM=; b=3eA6zIqsgvdk+SQixKGF6wB89IwB91gd3ltTIVTwO+ood+XFkXZ2TdoVkYotFlAMvi rfSppUQIY6N9d61L/7cySn82cZJ37KVw4MvX9ozxexh5mXUJ+nTLEgcCtmqBG6SHXmBc tVJ2qYXKqGLI6YtnK/hlEtPHFx7Gfpx0tnRX/WmaFSbCs3nGpt6LS5iIPJpoIBiw4nwP QXPwHu4mQV9gJu2iG61TBHRczsyZaF2YRyyw5pUznRde1M8tWhf8Ya+Rcn4Fvscai+sF vKmKMHRToP8ibjbfpWeWcxu1aCShDJXrzkYtw96Os5VFJIprpARxpXlbOzUEFJtDU1ff hYgw== X-Gm-Message-State: AO0yUKVFSGv/4WmBABmMbK+vH4UKK2nVoJq4MXxlFmGUixXo8Y/BqGd8 r2hW5vkOrY4nO0PPSCxC+x9TTQ== X-Google-Smtp-Source: AK7set869KvQa9AWPmDpPbocDf2+k7Q/+olIIlYDOHbAtBOpaiZYQMtYQ9M5v7ZkB/zs1eWq6ieU+A== X-Received: by 2002:a92:d34c:0:b0:322:ea3c:6775 with SMTP id a12-20020a92d34c000000b00322ea3c6775mr4174903ilh.24.1678651798760; Sun, 12 Mar 2023 13:09:58 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o19-20020a02cc33000000b003e69be53404sm1852812jap.150.2023.03.12.13.09.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Mar 2023 13:09:58 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 27740802A72; Sun, 12 Mar 2023 15:09:57 -0500 (CDT) Date: Sun, 12 Mar 2023 15:09:57 -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: <5073D187-4200-4A2D-BAC0-91C657E3C22E@gmail.com> <20230201155336.GU22427@telsasoft.com> <20230202151807.GY22427@telsasoft.com> <20230208224049.GO1653@telsasoft.com> <20230217002651.GW1653@telsasoft.com> <1000008.1678480570@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1000008.1678480570@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Mar 10, 2023 at 03:36:10PM -0500, Tom Lane wrote: > Justin Pryzby writes: > > Update to address a compiler warning in the supplementary patches adding > > assertions. > > 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: > > 1. It seems like a pretty expensive thing to do. Don't we have the > info at hand somewhere already? I don't know where that would be. We need the list of both direct *and* indirect partitions. See: https://www.postgresql.org/message-id/5073D187-4200-4A2D-BAC0-91C657E3C22E%40gmail.com If it would help to avoid the concern, then I might consider proposing not to call get_rel_relkind() ... > 2. Is it really safe to do find_all_inheritors with NoLock? If so, > a comment explaining why would be good. In both cases (both for the parent and for case of a partitioned child with pre-existing indexes being ATTACHed), the table itself is already locked by DefineIndex(): lockmode = concurrent ? ShareUpdateExclusiveLock : ShareLock; rel = table_open(relationId, lockmode); and childrel = table_open(childRelid, lockmode); ... table_close(childrel, NoLock); And, find_all_inheritors() will also have been called by ProcessUtilitySlow(). Maybe it's sufficient to mention that ? -- Justin