Re: Index use with left join

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Julian Scarfe" <julian(at)avbrief(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Index use with left join
Date: 2005-04-08 19:04:35
Message-ID: 16158.1112987075@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Julian Scarfe" <julian(at)avbrief(dot)com> writes:
> Does the planner "realise" that
> the intersection, Query 6, will still return 150 rows, or does it assume
> independence of the filters in some way and estimate
> 20,000*(150/20,000)*(396/20,000)?

It assumes independence of the conditions --- which is why having two
of them reduced the rowcount estimate so much. There are some limited
cases in which it can recognize redundant conditions, but offhand I
think that only works for scalar inequalities (like "x < 5 AND x < 6").
There just hasn't been a lot of work on geometric conditions ...

> Any general suggestions for workarounds?

Not much, other than trying to avoid redundant conditions.

Did you look into the state of the PostGIS work on geometric statistics?
It's bad enough not knowing how to combine geometric conditions, but
when the individual estimates themselves are completely bogus, you've
really got a problem :-(

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-04-08 21:17:15 Re: Can't install plpython on Windows 8.0
Previous Message Steve - DND 2005-04-08 19:00:19 Re: Can't install plpython on Windows 8.0