mdklatt@ou.edu (Michael Klatt) writes:
> select *
> from daily_rainfall as p, sites as s
> where p.site = s.ident and s.latitude >= -90 and s.latitude <= 90 and
> s.longitude >= -180 and terrain in ('A', 'I', 'L');
> Almost any combination of 'A', 'I', and/or 'L' consistently executes
> in the same time, but if it's ONLY 'A' PostgreSQL seems to go off into
> Never Never Land. There is no problem if 'I' or 'L' is used alone,
> just 'A'.
Sounds to me like it's switching from a good query plan to a bad one...
but since you haven't shown us EXPLAIN output nor described the
available indexes, it's hard to say much.
regards, tom lane