Re: Slow Count-Distinct Query
От | bricklen |
---|---|
Тема | Re: Slow Count-Distinct Query |
Дата | |
Msg-id | CAGrpgQ9ga0N0cF8+Z0ZW8t1mgS=3v1igVdaiciz-Q5Z7ddfOyA@mail.gmail.com обсуждение исходный текст |
Ответ на | Slow Count-Distinct Query (Christopher Jackson <crjackso@gmail.com>) |
Ответы |
Re: Slow Count-Distinct Query
|
Список | pgsql-performance |
On Sun, Mar 30, 2014 at 12:45 PM, Christopher Jackson <crjackso@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.
В списке pgsql-performance по дате отправления: