Re: Understanding bad estimate (related to FKs?) - Mailing list pgsql-performance

From Philip Semanchuk
Subject Re: Understanding bad estimate (related to FKs?)
Date
Msg-id BCDDA7C9-7999-4BFF-BDCA-7BF5E28A051C@americanefficient.com
Whole thread Raw
In response to Re: Understanding bad estimate (related to FKs?)  (Michael Lewis <mlewis@entrata.com>)
List pgsql-performance

> On Nov 2, 2020, at 6:09 PM, Michael Lewis <mlewis@entrata.com> wrote:
>
> The query I asked about in the original post of this thread has 13 relations in it. IIUC, that's 13! or > 6 billion
possibleplans. How did the planner pick one plan out of 6 billion? I'm curious, both for practical purposes (I want my
queryto run well) and also because it's fascinating. 
>
> Have you increased geqo_threshold and join_collapse_limit from the defaults?


Yes, thanks you, I should have said that. We avoid the GEQO, so geqo_threshold=25, and
join_collapse_limit=from_collapse_limit=24.We tend to have long running queries, so we’re happy to pay a few seconds of
extra planner cost to increase the likelihood of getting a better plan. 

Cheers
Philip


pgsql-performance by date:

Previous
From: "Ehrenreich, Sigrid"
Date:
Subject: Partition pruning with joins
Next
From: Philip Semanchuk
Date:
Subject: Re: Understanding bad estimate (related to FKs?)