"Jim C. Nasby" <decibel@decibel.org> writes:
> ... ISTM there's far more use for copying from a query
> result that just copying by index order.
Yeah. The other point is that it's entirely likely that an external
sort will be faster than using an indexscan to produce the sorted order.
If you instead create a command like COPY FROM (SELECT whatever FROM foo ORDER BY something)
then you give the optimizer a chance at deciding what to do ... not that
I promise it will get it right, but a fixed choice is certain to be
wrong.
regards, tom lane