"Jim 'Decibel!' Nasby" <jnasby(at)cashnetusa(dot)com> writes:
> So here's something odd... in both 8.3 and HEAD from a while ago it
> gives a better plan for SELECT * than for SELECT count(*):
The short answer is that the Subquery Scan nodes can be dropped out
when they are no-ops, which is to say producing the same set of columns
their input produces (and not testing any filter conditions, but that's
not relevant here). SELECT count(*) doesn't want to know about any
columns so the output of the UNION arm doesn't match ...
regards, tom lane