Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sXOW5-003kk5-PB for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jul 2024 17:14:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sXOW3-00Esn7-Kg for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jul 2024 17:14:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sXOW3-00Esmy-AV for pgsql-hackers@lists.postgresql.org; Fri, 26 Jul 2024 17:14:03 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sXOVx-001c13-7w for pgsql-hackers@postgresql.org; Fri, 26 Jul 2024 17:14:02 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 46QHDsWM1743895; Fri, 26 Jul 2024 13:13:54 -0400 From: Tom Lane To: Anthonin Bonnefoy cc: PostgreSQL Hackers Subject: Re: Add ALL_CANDIDATES option to EXPLAIN In-reply-to: References: Comments: In-reply-to Anthonin Bonnefoy message dated "Fri, 26 Jul 2024 18:59:07 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1743893.1722014034.1@sss.pgh.pa.us> Date: Fri, 26 Jul 2024 13:13:54 -0400 Message-ID: <1743894.1722014034@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Anthonin Bonnefoy writes: > I have a prototype for an ALL_CANDIDATES option for EXPLAIN. The goal > of this option is to print all plan candidates instead of only the > cheapest plan. It will output the plans from the most expensive at the > top to the cheapest. This doesn't seem feasible at all to me. If we don't prune plans fairly aggressively at lower plan levels, we'll have a combinatorial explosion in the amount of work the planner has to do. Have you tried this on even slightly complex plans --- say, a dozen-way join? I do not think you'll like the runtime, the amount of memory consumed, or the verboseness of the output. (I wonder how it interacts with GEQO, too.) regards, tom lane