"Tim Yardley" <yardley@gmail.com> writes:
>> Can you strace the backend while it's doing this and see if there's a
>> difference in the series of kernel calls issued?
> See attached strace. Let me know if you see anything enlightening.
Nope :-(. The strace output is *exactly* the same across all four
instances, except for the number of bytes sent over to the client,
which reflects the difference between "504" and "0". It's possible
that something is lurking in the data that strace didn't show, but
I think that's unlikely. Somehow the misfeasance is happening within
Postgres proper.
I think you'll have to get out a debugger and trace through it to
find out where the rows are getting discarded ...
regards, tom lane