Re: Bad Estimate for complex query with JOINS on subselects and OR in where conditions

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Grman <peter(dot)grman(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Bad Estimate for complex query with JOINS on subselects and OR in where conditions
Date: 2019-08-16 13:44:48
Message-ID: 9725.1565963088@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Grman <peter(dot)grman(at)gmail(dot)com> writes:
> our ORM with tenant separation enabled is creating the following query:

Ugh.

By my count there are nine joined tables in that query, which means
you're hitting the default join_collapse_limit. Increasing that
setting might improve matters somewhat, though it won't fix the
bad rowcount estimate per se.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message PegoraroF10 2019-08-16 13:52:16 Re: slow queries on system tables
Previous Message Charles Clavadetscher 2019-08-16 13:25:30 Re: Variable constants ?