Waiting for 8.4 - hash based DISTINCT
Today Tom Lane committed patch which gives DISTINCT ability to use hash aggregate - just like GROUP BY.
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: