Robert Haas wrote, and Tom Lane committed (on 2nd of August) patch which adds interesting capability: Log Message: ----------- Add ALTER TABLE ... ALTER COLUMN ... SET STATISTICS DISTINCT Robert Haas Log message is rather terse, so what does it exactly do?
Every so often you need to get list of unique elements in some column. The standard way to do it is: select distinct column from table; or select column from table group by column; The only problem is that it's slow - as it ...
Today Tom Lane committed patch which gives DISTINCT ability to use hash aggregate - just like GROUP BY.
When I was working for one of customers we found some strange thing. We needed to found number of distinct sessions per day. Table layout was very simple:
