On Sun, Mar 30, 2014 at 12:45 PM, Christopher Jackson <crjac...@gmail.com>wrote:

>   Hi all,
>
>   tl;dr - How can I speed up my count-distinct query?
>

Depending on how often you need to run that query and how important it is
to you, if you are willing to accept a performance hit on
INSERT/UPDATE/DELETE of the "participants" table, you could create a
summary table containing just the count of unique email addresses or the
list of unique email addresses populated via trigger on
INSERT/UPDATE/DELETE of the  participants table. Another option is try out
the new Materialized views (
http://www.postgresql.org/docs/current/static/sql-creatematerializedview.html)
available in 9.3.

Reply via email to