3 ms·
You may be interested in this technique, or some of the others in the article: https://www.citusdata.com/blog/2016/10/12/count-performance/#dup_counts_estimated
by rattray 6y ago
You may be interested in this technique, or some of the others in the article: https://www.citusdata.com/blog/2016/10/12/count-performance/#dup_counts_estimated_filtered https://www.citusdata.com/blog/2016/10/12/count-performance/...
EDIT: I'm also curious what version of Postgres you've experienced this on? Sounds like there may have been improvements to COUNT (DISTINCT in v11+
- caioariede 6y agoIf you're not making a lot of writes, that may be good approach since AFAIK the counts will only be updated after the table is ANALYZE'd