> postgres collect all necessary stats. Maybe an implicit analyze is
> necessary?
Should be: "explicit analyze".
> > > BUT I found the real cause of my problem - the "fk2" field from my
> > > example had not only an index, but it was also a foreign key to
> > > another table.
> > That seems unlikely to be the cause.
It's just what I saw. First I tried with all the FKs but had to break
the queries because they took too long.
Then I dropped the FK and the query run in a couple of minutes.
Thanks,
MS