Faster PostgreSQL Counting

PHOTO EMBED

Tue Aug 03 2021 04:37:21 GMT+0000 (Coordinated Universal Time)

Saved by @mvieira

EXPLAIN SELECT count(*) FROM items;

Aggregate  (cost=20834.00..20834.01 rows=1 width=0)
  ->  Seq Scan on items  (cost=0.00..18334.00 rows=1000000 width=0)
content_copyCOPY

https://www.citusdata.com/blog/2016/10/12/count-performance/