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.96) (envelope-from ) id 1w7M51-005DRu-2q for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 23:31:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w7M50-00787J-0r for pgsql-hackers@arkaria.postgresql.org; Mon, 30 Mar 2026 23:31:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w7M4z-007874-3B for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 23:31:34 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w7M4y-00000001slh-3Gk0 for pgsql-hackers@lists.postgresql.org; Mon, 30 Mar 2026 23:31:33 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-486b9675d36so42174435e9.0 for ; Mon, 30 Mar 2026 16:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774913491; cv=none; d=google.com; s=arc-20240605; b=G8UQ5Im7Km99exrBiRDou+ygN1Y8F95oMGI1Y+uT3zaIDu3ROUzARCFMam46oDiVam MoIdCifuv1Nse+RjW9HTRsfRP29T7hVPdPm7yMuOtR/0KlA9JcOtVSt1veoyQDCDWy/9 jQ//2VMeXOLYuBq2KsrJFvDBX2YJEcnH6Y8VarhcghItQ+8h70YduVcAarlWXXLP1L28 k76D1QyHe4nXYtnp10DvoGhb3ih05UmYybrY9VRJ1j9cf9FvEMYiEoH9viRmuzGKA8R0 /QpwFTXsZDF727D6mXOS8cn7NBkwTs5ewylzAf/Snny3S+2pqMrvyAN+mF6Khc+QBDVj VBhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=g1NJdbeLBA9QO6Wgt1HsNlv4zSLGAdSJhLiQOQt19RQ=; fh=Kzs43jfnFfde89nf+sSg5WNBukp748K3zokr/Aez6qo=; b=UV0ddg+DQPT19t8RXNO8iF7yIbQcernTwrzQexwX/kxkAI7ER8EZt3T4dwgQCX7Dhq A31zGm0Cg0eTLT1heZv69rCHEAyrxjljiFpBnOPIU/uk+dOWVoVWlYYS3Z6KdTKPB2pL Ky69rJjaMZALy4Z39CwLZxGnC+2cg3WaJxMTLe7YpiylvfhaEFDW2h63RNbrfN7GGehR GyghOq5Z+Jz1yQig8mjzl2Lpjv8cSMH+tVZdBu2TP2ZCiJpjG7Ru8cFvyleOadI0s81S pM+ICD6YkRUg5Vdh4dA+QwAC8oNh8ZdHi7tW9/uX54kvve3bCxeeEHX5+mwikTArJUdx s5zA==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774913491; x=1775518291; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=g1NJdbeLBA9QO6Wgt1HsNlv4zSLGAdSJhLiQOQt19RQ=; b=B5FrcpEMfdwppWL8ub/s0As4S/EWdZ+2Rl7r4/claPJlSHFAsmGlvmiAy3ECDHLOTM ZkM9mGZvn4GlYzCW+6kJ0ueLPCKVU+8+2kiK29LQEYJ7iAljrOjBbr8OBH/JPKT+SVFm Au/TAEi5vYpL/eDkcFGGZaSLNk91X2k/XEqKrg/1PnkVnSm4uYCywNkeIj7/d+ehgdXf /KF7dcV8dimk/054R1jMiGhues6VCaC0RVv5aFsdaZTgOd23DKUhKfkSJ3f+KIUg0YA4 8yksECH8Vp/701uNZEXxrko89bHRvlKCjEBn04Xzz/fehgqMUCGlNPkYcMXeKH5C6ZS9 nVAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774913491; x=1775518291; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=g1NJdbeLBA9QO6Wgt1HsNlv4zSLGAdSJhLiQOQt19RQ=; b=iUp44/BCzCN/eKZzkPtDc937Fb+p6R4W4JEIFMRFAATcj4Kv+TNal49Cc4BglK8ykM 71x4xpHzTEdxWknkkcXrV2zmXNIQMLd1CD2/H+b78M8teKCR3vmts+AjaEQcSiPMi1Dp ix+cyFU/6kwMh4xXaMhwvuHQin8foXHljohg0ejwv/7rpQoOQhHd7AhEcptP09UsDSOr Xq9BKIJGtYQLTSRahQh65tJ5uHr3OOdKtN4V+13/3m3+Ezdd8RBd8oLqqNnx/2jmpB0r ZeamAEGAsQFHFVnqtp78IVyNBJqKe+zG/VaKu0g9x8UnWaCiQO5r4lMfQJnOxFlDKQ9P 1+iQ== X-Forwarded-Encrypted: i=1; AJvYcCXxQdaGB8H/lRRm8CD891HOoyEOim9pvRSseYdxPHkZHDKxcouXEv/JK85D0vXZ5fZH1lFVWV5ZP39Q/mgp@lists.postgresql.org X-Gm-Message-State: AOJu0YziwtpkWcI83fBdMkjS4rqEz3kRp4kfVEv5EwnOFnlHjgFvZw+t oyDKs4n0TgzxO+YDWrwIhckScex4BTUGo9JG0VyiKoZb4WwwgEG8tH3Mqzl73ehBt2Fgj3P7C7n 833b41JlS+R6HEQEGESCGm7TxyVfeFBQ= X-Gm-Gg: ATEYQzwwKoEt/CjXieil1XhfS+5hkAoDVGD2iQh9wjkbAAk22VtivAedT+9VuLEdPnF 7OG8eGI8EVPIKX5W1qvkQUGmUvJoW29CkFKgXlLZC3XrrKLrEdcMpITqU/5MFWZjELtFzu0ixq7 VIvB/GAPbBgO3jlrnz9mQuv4ZFFG6KzFiQgzyxUunZp8W/wXEuyTdTdlhf/Mu1fRXaMWWv0Bx8H Qq3t5TUihv3wCB0MWsd8/ZRCOhkKTCAplQoY261x9bjU05yq33l83JCYLxYcDKpe7UyBxxAUmGc D5aUGUVaOBeiOC6ZjwyD7Mme2b5He2HnuZPNeGSb2lWl+kAdqmbj8qDBXnpifxk+zl7BqQbCcg= = X-Received: by 2002:a05:600c:34cf:b0:477:a1a2:d829 with SMTP id 5b1f17b1804b1-48727d84062mr261403845e9.13.1774913491310; Mon, 30 Mar 2026 16:31:31 -0700 (PDT) MIME-Version: 1.0 References: <2005009.1774880253@sss.pgh.pa.us> <2588262.1774911610@sss.pgh.pa.us> In-Reply-To: <2588262.1774911610@sss.pgh.pa.us> From: David Rowley Date: Tue, 31 Mar 2026 12:31:19 +1300 X-Gm-Features: AQROBzAWkSjtDzCQt1wSuYRbeMTX84dShvPnBm9emhw8t507ipVcnC_tsjGu6SI Message-ID: Subject: Re: scale parallel_tuple_cost by tuple width To: Tom Lane Cc: Andrew Dunstan , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 31 Mar 2026 at 12:00, Tom Lane wrote: > What I'm concerned about is that the estimated cost's dependency on > tuple width may be much stronger here than it has been in other uses. > That impression might be false, of course. I think it's good to be concerned, but I think this is far from the worst place to put trust in the width estimates. We also use them in Memoize, and if we underestimate there, then we might end up with a Nested Loop -> Memoize plan instead of a Hash or Merge Join. If the actual Memoize cache hit ratio ends up much worse than expected due to wider-than-expected tuples, then the chosen plan might be well off being the optimal one. The execution costs of running a poorly chosen Nested Loop with a poorly caching Memoize can become quadratic. I think the parallel vs non-parallel problem is much more linear. I'm more concerned about the opposite problem of being too liberal and choosing parallel plans too often, resulting in worker exhaustion and poorer performance as a result of serially executing parallel plans. I suppose people could fix that by bumping up the parallel_setup_cost so that the planner favours reserving parallel workers for plans that get much bigger benefits from parallelisation. David