Alessio Bragadini <alessio@albourne.com> writes:
> The following (rather long) query run fine for some time when executed
> through Micro$oft Query via Psqlodbc. We never tried it under psql.
> Today it appeared broken (some trickery on the Excel worksheet seems to
> have fix that) and for the first time I tried to run it from the command
> line. I never managed, psql always breaks in the same way:
Try doingset ksqo = 'on';
in psql before you run the query. I think the ODBC driver does that for
you automatically.
The regular 6.5 optimizer tends to blow up when faced with large
OR-of-ANDs WHERE clauses. 7.0 will be a lot better about it...
but in the meantime you need the KSQO hack.
regards, tom lane