Slow PostgreSQL COUNT, a solution

Hello Fellow Rubyists,

We use PostgreSQL at work and having been running into slow COUNT
queries. After a bit of research I implemented a viable workaround. I
wanted to share it and get some feed back on solutions other people have
found successful. My workaround is posted on my blog:

http://www.verygoodindicators.com/blog/2015/04/07/faster-count-queries/

Thanks,
Juan

What you are suggesting sounds like a complicated (hence potentially
error prone) way to access statistics data. You can query it from
system catalogs directly:

http://www.postgresql.org/docs/9.4/static/view-pg-stats.html
http://www.postgresql.org/docs/9.4/static/catalog-pg-statistic.html