Ignore order when doing count.

This is necessary because Postgresql doesn't play nice with ORDER BY and
no GROUP BY.

Fixes #14621.