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 1p2dBS-0004Hj-Gd for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 19:00:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2dBR-0004wQ-Er for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 19:00:49 +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 1p2dBR-0004wF-4e for pgsql-hackers@lists.postgresql.org; Tue, 06 Dec 2022 19:00:49 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2dBK-0003Si-7Q for pgsql-hackers@postgresql.org; Tue, 06 Dec 2022 19:00:48 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 8E69D320091C; Tue, 6 Dec 2022 14:00:38 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 06 Dec 2022 14:00:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1670353238; x=1670439638; bh=q +6Qw2xwJs2YQxF2f18E5lZ0vbUUaoZ+HWMxHbQVUr4=; b=nwE1QGzalZj8fC5zX pyGqGfKMIjFsrdkDpcUjxQnjnr6Np34/PZCbkqnKvgaOwXxuZN35AI5rQmZWOp7d Y640aF9306iWy23Pbr/IdgiL8cbGd5y0cYVEdG2wHl6puTwOpn9WKjs8ZayLDSZO 4wpb9eV1gLQD7PvDM4aql+cee8sD6SFw1ahkjQBLmJKNMKj2u4dAX3RRBcVVbhXF 3xQcG6b69gB/LpIJMiFjyUfBR9vGyL5ncJNlqeaBHhuUM+SzgaRyNxgqbMfkGhiP Z6CdQeZ6MqZvqPFedT6nEeLVQuv2s+zpVDW9qZBjoYkJmXmACyYVyjx5ByrxEgcW Odt3Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeigdduvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Dec 2022 14:00:37 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id ADBD8E98; Tue, 6 Dec 2022 20:00:33 +0100 (CET) Date: Tue, 6 Dec 2022 20:00:33 +0100 From: Alvaro Herrera To: Amit Langote Cc: Robert Haas , Jacob Champion , David Rowley , Tom Lane , PostgreSQL-development Subject: Re: generic plans and "initial" pruning Message-ID: <20221206190033.mr5fiucsj4izhc6k@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I find the API of GetCachedPlans a little weird after this patch. I think it may be better to have it return a pointer of a new struct -- one that contains both the CachedPlan pointer and the list of pruning results. (As I understand, the sole caller that isn't interested in the pruning results, SPI_plan_get_cached_plan, can be explained by the fact that it knows there won't be any. So I don't think we need to worry about this case?) And I think you should make that struct also be the last argument of PortalDefineQuery, so you don't need the separate PortalStorePartitionPruneResults function -- because as far as I can tell, the callers that pass a non-NULL pointer there are the exactly same that later call PortalStorePartitionPruneResults. -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "La primera ley de las demostraciones en vivo es: no trate de usar el sistema. Escriba un guión que no toque nada para no causar daños." (Jakob Nielsen)