Is “forking” count some special operation or just a nice word in place of swearing?
Regarding (exact) count, pretty much every system has trouble doing this quickly and on most cases you really don’t need an exact count. This is especially true for medium to large data.
Table/index statistics that are kept up to date will give a good approximation.
HyperLogLog was one option mentioned which will give good-enough approximations, another approach is log-normal histograms. I don’t think this challenge is unique to PG.
Yes, it's a replacement word, and a reference to "The Good Place" TV series.
And regarding count, no system suffer as much from it as PG. Approximations are rarely an option, and while this challenge is definitely not unique to PG, the PG is doing it worst of all DBMS. Except, maybe, sqlite, and even that I'm not sure.
Such a simple functionality, but can't be implemented properly for more than a dozen of years already. PG's count can be 15x times slower than that of MySQL and 70x slower than Oracle or SQLServer. And that sheet has been there for ages. And is till there.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.