Greg Stark <gsstark@mit.edu> writes:
> The example above raises another idea though. Would it be possible for the
> optimizer to recognize when a clause is so expansive that it would be faster
> to read the complement than the actual clause as written?
Being able to compute the complement, much less do so with an indexable
clause, is usually difficult in SQL (think about NULLs). In any case
I think this is the situation where you are happy to fall back to a
seqscan.
regards, tom lane