Re: [HACKERS] Bogus nestloop join estimate, ignores WHERE clause

2011-08-31 Thread Tom Lane
Marti Raudsepp writes: > On Wed, Aug 31, 2011 at 23:59, Tom Lane wrote: >> Could we see the pg_stats rows for the two join columns? > Sure, but I don't want to send this out to the public list since > [ it's private data ] Thanks for the data. I set up a comparable test case and duplicated you

Re: [HACKERS] Bogus nestloop join estimate, ignores WHERE clause

2011-08-31 Thread Tom Lane
Marti Raudsepp writes: > After a bit of digging, I figured out that it uses the same estimate > as a semi-join WITHOUT the client_id restriction. > ... > For whatever reason, the 1st query completely ignores the fact that > the client_id clause reduces the result count by a large factor. Could we

Re: [HACKERS] Bogus nestloop join estimate, ignores WHERE clause

2011-08-31 Thread Marti Raudsepp
On Wed, Aug 31, 2011 at 16:34, Peter Eisentraut wrote: > On ons, 2011-08-31 at 15:38 +0300, Marti Raudsepp wrote: >> I'm getting really surprising planner estimates for a query that's >> joining another table via a varchar field. All of this was tested on >> PostgreSQL 8.4.8, 9.0.4 and 9.1rc1. > >

Re: [HACKERS] Bogus nestloop join estimate, ignores WHERE clause

2011-08-31 Thread Peter Eisentraut
On ons, 2011-08-31 at 15:38 +0300, Marti Raudsepp wrote: > I'm getting really surprising planner estimates for a query that's > joining another table via a varchar field. All of this was tested on > PostgreSQL 8.4.8, 9.0.4 and 9.1rc1. By any chance, did it work better in 8.4.7? -- Sent via pgs

[HACKERS] Bogus nestloop join estimate, ignores WHERE clause

2011-08-31 Thread Marti Raudsepp
Hi list! I'm getting really surprising planner estimates for a query that's joining another table via a varchar field. All of this was tested on PostgreSQL 8.4.8, 9.0.4 and 9.1rc1. The original query is pretty huge, but I managed to shrink it down to this: SELECT * FROM email_message where email_