Kevin Goess <kgoess@bepress.com> writes:
> On Mon, Mar 19, 2012 at 9:24 AM, Albe Laurenz <laurenz.albe@wien.gv.at>wrote:
>> That means that your statistics are not accurate.
> Aha, thanks, that explains why my test table with one row was so bad. But
> even with all freshly ANALYZE'd tables, I still see the query reverting to
> a sequential scan on that big contexts table once the number of rows in the
> subselect goes over 199. Here's a simplified version that demonstrates the
> problem.
You've still got a nasty join-size estimation error:
> -> Nested Loop (cost=6.18..1939.43 rows=411736 width=8) (actual
> time=0.203..3.487 rows=35 loops=1)
It's not apparent why that's so far off ...
regards, tom lane