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 1oe9lT-0001pu-7k for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2022 06:44:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oe9lR-0003Bi-Qy for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Sep 2022 06:44: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 1oe9lR-0003BZ-Fv for pgsql-hackers@lists.postgresql.org; Fri, 30 Sep 2022 06:44:49 +0000 Received: from mx.zeyos.com ([88.99.153.70]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oe9lP-0004A6-TT for pgsql-hackers@lists.postgresql.org; Fri, 30 Sep 2022 06:44:48 +0000 Received: from mx.zeyos.com (localhost [127.0.0.1]) by mx.zeyos.com (Postfix) with ESMTP id 404EB619FB for ; Fri, 30 Sep 2022 08:44:47 +0200 (CEST) Authentication-Results: mx.zeyos.com (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=zeyos.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=zeyos.com; h= content-transfer-encoding:content-type:content-type:mime-version :references:in-reply-to:message-id:to:from:from:subject:subject :date:date; s=dkim; t=1664520287; x=1665384288; bh=25qdDvuEgfY1N bwL9ZNQ00C8hSYnZeyrRuymxLnav4M=; b=QAyLmBxpaMK2fy9Fp5NhprPDDuIXU Q9eezTLykiBNwmT9BxpIBXH/KVjL47WX6CQBoDUPdR+qzLMHb7jLYKNiSp0lPiwc c+dLMB2sYkQBsjYHI6Xe4PmAH8Tp4E/qZtImRhRncTkwtNPrIItLForrFqF3bzsj CSKAnW2vuv7nHk= X-Virus-Scanned: Debian amavisd-new at mx.zeyos.com Received: from mx.zeyos.com ([127.0.0.1]) by mx.zeyos.com (mx.zeyos.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id mo2188YqVOi7 for ; Fri, 30 Sep 2022 08:44:47 +0200 (CEST) Received: from cloud.zeyos.com (static.182.82.88.23.clients.your-server.de [23.88.82.182]) by mx.zeyos.com (Postfix) with ESMTPSA id DBABC619E0; Fri, 30 Sep 2022 08:44:46 +0200 (CEST) Date: Fri, 30 Sep 2022 08:44:46 +0200 Subject: Re: disfavoring unparameterized nested loops From: Benjamin Coutu To: Peter Geoghegan , Tom Lane Cc: Bruce Momjian , PostgreSQL Hackers , Robert Haas , David Rowley Message-ID: <1a5bad8002cee1307653@zeyos.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > In general I suspect that we'd be better off focussing on mitigating > the impact at execution time. There are at least a few things that we > could do there, at least in theory. Mostly very ambitious, long term > things.=0A=0AI think these things are orthogonal. No matter how good the = cost model ever gets, we will always have degenerate cases.=0AHaving some s= marts about that in the executor is surely a good thing, but it shouldn't d= istract us from improving on the planner front.=0A >=20 > I like the idea of just avoiding unparameterized nested loop joins > altogether when an "equivalent" hash join plan is available because > it's akin to an execution-time mitigation, despite the fact that it > happens during planning. While it doesn't actually change anything in > the executor, it is built on the observation that we have virtually > everything to gain and nothing to lose during execution, no matter > what happens.=0A=0AI agree with you, that those plans are too risky. But = let's maybe find a more general way of dealing with this.=0A > Right. Though I am actually sympathetic to the idea that users might > gladly pay a cost for performance stability -- even a fairly large > cost. That part doesn't seem like the problem.