Re: from_collapse_limit vs. geqo_threshold - Mailing list pgsql-hackers

From Robert Haas
Subject Re: from_collapse_limit vs. geqo_threshold
Date
Msg-id 603c8f070905202131n65dabc3cnb74b9f0b9524d151@mail.gmail.com
Whole thread Raw
In response to Re: from_collapse_limit vs. geqo_threshold  (Josh Berkus <josh@agliodbs.com>)
List pgsql-hackers
On Thu, May 21, 2009 at 12:21 AM, Josh Berkus <josh@agliodbs.com> wrote:
>> It appears that this statement has been in our documentation since Tom
>> Lane added FROM_COLLAPSE_LIMIT (back then, it was capitalized) on
>> January 25, 2003 (9bf97ff426de9), but I can't find any justification
>> for it anywhere.  I think we either need to justify this advice, or
>> remove it.
>
> ... trying to remember why I wrote that ... what would happen if
> FROM_COLLAPSE_LIMIT was *more* than GEQO_THRESHOLD?

The two variables do different things, so there's nothing particularly
magical about which one is larger AFAICS.  I believe that if you make
from_collapse_limit larger than geqo_threshold, then GEQO might be
asked to plan a query into which subqueries have been pulled up.  But
that's not obviously bad; the alternative is planning the subquery
separately and first, which at least for the very small number of
cases that I've tested seems to be quite a bit worse.

Apparently before from_collapse_limit was added the behavior existed,
but the thereshold was geqo_threshold/2.  So someone had a reason for
believing that when the join nest got too large, not pulling up
subqueries was a superior coping strategy versus invoking GEQO.  I
just don't know what the reason is, or whether it's still valid.

...Robert


pgsql-hackers by date:

Previous
From: Josh Berkus
Date:
Subject: Re: from_collapse_limit vs. geqo_threshold
Next
From: Pavel Stehule
Date:
Subject: Re: plpgsql + named parameters