Dav Coleman <dav(at)serve(dot)com> writes:
> I have noticed that the semantically equivalent SQL queries can
> differ
> vastly in speed performance depending on the order of clauses ANDed
> together ( "WHERE cond1 AND cond2" takes forever, but "WHERE cond2
> AND cond1" comes right back).
Could we see a specific example?
It would also be useful to know what PG version you are using, whether
you've VACUUM ANALYZEd the tables, and what EXPLAIN has to say about
your query.
regards, tom lane