I've done some reading in google and the only thing I did was get myself confused. Some of the people say that count() is slower with many records, others say you can cache the number or even use sequence...
What's the best way to count many rows in a table with best performance and lowest cpu/ram usage? By many I mean >=500,000 rows.
The best way I know of to tweak
count()
's performance on huge data sets is tocount()
something that's been indexed (if you're trying to count a partial result, you can create a matching partial index).