Greg Stark <gsstark@mit.edu> writes:
> However I tested those queries with some data and things really do seem to be
> behaving oddly. It takes nearly twice as long to run the version with the
> where clause and duplicate subplan.
Yes, they will both be executed --- there's no
duplicate-subexpression-elimination logic...
regards, tom lane