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 1vTZvP-0054cy-2h for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Dec 2025 06:13:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vTZvN-002RfL-1L for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Dec 2025 06:13:14 +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.96) (envelope-from ) id 1vTZvN-002RfD-0P for pgsql-hackers@lists.postgresql.org; Thu, 11 Dec 2025 06:13:13 +0000 Received: from mail-yx1-xb132.google.com ([2607:f8b0:4864:20::b132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vTZvL-0006wJ-0f for pgsql-hackers@lists.postgresql.org; Thu, 11 Dec 2025 06:13:13 +0000 Received: by mail-yx1-xb132.google.com with SMTP id 956f58d0204a3-6446d7a8eadso564206d50.0 for ; Wed, 10 Dec 2025 22:13:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765433588; x=1766038388; 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=6j13tc99MQV82rriEbnwskXO8iY2MiVL6qCpB8tWIS8=; b=SFd82vb8pq/Jax1P1ZLraoTsnHGdOCYy0NqAQlft+G/qPq5vPsnJ618IiHjkUb2fVQ Y2dK1Zg51yD8lDpbilxpsyQNbcQSLUwOsy1vcYooiMbYDEnlzcqSxLp+Mo/yhvhHSKls dBHHMgSHP+7oY5BsrpA6M8fOVELtHkfza1t9pAcYi1ixkJhbBj5ILYzaK+icfQlK9hYV /1/aMsf52Ol2nTYrMIEv/hlq69FHeeUKDSmENRHscnsAJxdxkTb8IDeTWJqeZcGlSuM+ cROUsVemWXOvUmqKH7s3UUETH1uZmKcIr5OLxSqxutHcnvtjNuC3k7vWXUtzggeLaiYW 2r8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765433588; x=1766038388; 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=6j13tc99MQV82rriEbnwskXO8iY2MiVL6qCpB8tWIS8=; b=ROOMRtWbKQVZiM1nJ8rota7ppIoUsZQb0QkU8UVV6IGECpDvK44O1bG+D2pueVv7lX 5SSZ3vI2fFF11fxoAbZaaLEkQZlkmuBTHsCQkkstzqhc93ckCboev25MMfOcLseU1M4A M7jraCSBVWak7JMosXE/oSBuVEbjQRY3XvwbZ01RKOoQ2u1IeKrBJHTOFh4HKYG05uf3 ZIUEuCbFaBy6E+/rwqaIVwmWO4g+GlBwKSc+FkSfOieSICB+p9GNWvLHqPC5xVLF3vLT SIu268Ymr9nNWH1J/4RPrFkVFR9nleOJzfIQhSOBMVm1o2prpUqEI9G+3SZ0YuyLhIHy qNPg== X-Forwarded-Encrypted: i=1; AJvYcCVd6L9FA9/G8EtIKrBUK3/dXIOg9Ipv/ywD2FMUBdYJqKswt9+hr/AMm1sce8l/tQL2ZVEyCJwPQbHdyMY1@lists.postgresql.org X-Gm-Message-State: AOJu0YxylmtdHpKIUoZKNeqZeeMSh7iWsYVMwHBU4cky1dUHoGor5e2N Idm3VrYWKOOisswukFW9gCrKLIlvoT6HuxzsFJdaykYKpVKvqga4YCqctbttCAS2mSoOBxFX+Ik ljkZrKYZ0my3s80ejkIhCTsrxHb7//m4= X-Gm-Gg: AY/fxX5GkJZ7+KeX0KUi0VpX+SevlkagDrXMFqI1xeg4h6VxRsxAPEjKa0HJ4R3x7JU OPrwDnoal2Kh8Gs/Efi39LJCEoB94OFptfcfx1hRRAD0whyq4U/x7SzWRmMQLhweNSzOqbH5H5t 5IrU37WfvS2NItke+S/Nmn46FOl3VeT9ln55+jtblv+v6JApSboWaV4fiW6lYdiBQyU06PE8Wfd R5goDUl414S5tO10J0n0jg6wqsaHB/Rl8JRjec0nbxa4RXbWRAessLeHSqx6dROZeutemNtNM+j jOmucU2RuO8Zx04aN5LOmKBe31Jnm3jw4E5aFM0Ppoc0XiWDc7HRI3eW5KY7xr8mYVDj2LYzdXA 8IJWOmK0AboVOKNDz03g7Yt2J X-Google-Smtp-Source: AGHT+IEpPEGaNj+/4bJVivGB/cOseJ0qOXwgBxRr0A/IWgI0rMX1Xuko1jm1zm0e69eTOtPc2ZQs/yk4q4J2kWXuVOg= X-Received: by 2002:a05:690e:255c:b0:644:4749:83fd with SMTP id 956f58d0204a3-6446eb29512mr2908153d50.73.1765433588373; Wed, 10 Dec 2025 22:13:08 -0800 (PST) MIME-Version: 1.0 References: <3FF63E99-AB4F-41A9-BC78-AAB28823FBD0@Outlook.com> <6db6d2ec-7529-4add-9a95-178fc318311d@vondra.me> <313ACE5A-CBF1-43B3-9181-10D3E8ADF424@Outlook.com> <5abd6054-413c-4f48-9172-d8b31062b266@vondra.me> <938E2286-9B0D-4F8D-A916-8E0E35D55034@Outlook.com> In-Reply-To: From: Pavel Stehule Date: Thu, 11 Dec 2025 07:12:29 +0100 X-Gm-Features: AQt7F2rxKVbpbFgqD3KnhFnxFfRaTTu-oKcxuYgESPvjUrCwuEJll9dDph-Wt9s Message-ID: Subject: Re: Add a greedy join search algorithm to handle large join problems To: John Naylor Cc: Tomas Vondra , Chengpeng Yan , "pgsql-hackers@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000e8dd9b0645a709a4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000e8dd9b0645a709a4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable =C4=8Dt 11. 12. 2025 v 3:53 odes=C3=ADlatel John Naylor napsal: > On Wed, Dec 10, 2025 at 5:20=E2=80=AFPM Tomas Vondra wr= ote: > > I did however notice an interesting thing - running EXPLAIN on the 99 > > queries (for 3 scales and 0/4 workers, so 6x 99) took this much time: > > > > master: 8s > > master/geqo: 20s > > master/goo: 5s > > > It's nice that "goo" seems to be faster than "geqo" - assuming the plan= s > > are comparable or better. But it surprised me switching to geqo makes i= t > > slower than master. That goes against my intuition that geqo is meant t= o > > be cheaper/faster join order planning. But maybe I'm missing something. > > Yeah, that was surprising. It seems that geqo has a large overhead, so > it takes a larger join problem for the asymptotic behavior to win over > exhaustive search. > If I understand correctly to design - geqo should be slower for any queries with smaller complexity. The question is how many queries in the tested model are really complex. > > -- > John Naylor > Amazon Web Services > > > --000000000000e8dd9b0645a709a4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=C4=8Dt 11. 12.= 2025 v=C2=A03:53 odes=C3=ADlatel John Naylor <johncnaylorls@gmail.com> napsal:
On Wed, Dec 10, 2025 at 5:20=E2= =80=AFPM Tomas Vondra <tomas@vondra.me> wrote:
> I did however notice an interesting thing - running EXPLAIN on the 99<= br> > queries (for 3 scales and 0/4 workers, so 6x 99) took this much time:<= br> >
> master:=C2=A0 =C2=A0 =C2=A0 =C2=A08s
> master/geqo: 20s
> master/goo:=C2=A0 =C2=A05s

> It's nice that "goo" seems to be faster than "geqo&= quot; - assuming the plans
> are comparable or better. But it surprised me switching to geqo makes = it
> slower than master. That goes against my intuition that geqo is meant = to
> be cheaper/faster join order planning. But maybe I'm missing somet= hing.

Yeah, that was surprising. It seems that geqo has a large overhead, so
it takes a larger join problem for the asymptotic behavior to win over
exhaustive search.

If I understand corr= ectly to design - geqo should be slower for any queries with smaller comple= xity. The question is how many queries in the tested model are really compl= ex.

=C2=A0

--
John Naylor
Amazon Web Services


--000000000000e8dd9b0645a709a4--