PostgreSQL - count() performance and how to tweak it?

Solution 1:

The best way I know of to tweak count()'s performance on huge data sets is to count() something that's been indexed (if you're trying to count a partial result, you can create a matching partial index).