This query doesn't search for anything, it takes all records including everything. Counting all records in a table, isn't the best part of PostgreSQL and we avoid this (for large tables) by maintaining an aggregate table. A query like this will be processed in half a millisecond, even for billions of records in the main table: the query doesn't even touch this large table. cybertec-postgresql.com/en/postgresql-count-made-fast
↧