count

Blog

How to optimize Postgres for SELECT COUNT(*) on massive tables

Short answer: "you can't". Long and more complex answer: "you can play with indexes".

Read