Re: Query with large number of joins

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Marco Di Cesare <Marco(dot)DiCesare(at)pointclickcare(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Query with large number of joins
Date: 2014-10-21 16:46:46
Message-ID: 6038.1413910006@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Have you tried a) either turning off geqo or setting geqo_threshold
> fairly high b) setting join_collapse_limit fairly high (assuming all the
> above join targets are tables and not views, setting it to something
> like 25 should do the trick.

You'd have to do both, I think, to get an exhaustive plan search.

In any case, this query is going to result in full table scans of most
of the tables, because there just aren't very many WHERE constraints;
so expecting it to run instantaneously is a pipe dream. I'm not sure
that there's a significantly better plan to be had.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2014-10-21 16:50:32 Re: Query with large number of joins
Previous Message Andrew Dunstan 2014-10-21 16:31:06 Re: Query with large number of joins