How to speed up Count(*) in Interbase/Firebird – Stack Overflow
Posted by jpluimers on 2017/02/14
The drawback of how the multigenerational architecture is implemented:
Even when an index is available on the column or columns included in the COUNT, all records must be visited in order to see if they are visible under the current transaction isolation.
The benefits of having far less locking than other architectures means you need to be careful using the COUNT operator on large result-sets.
In many systems the exact result of a COUNT isn’t very important, so you can use the workaround referred from How to speed up Count(*) in Interbase/Firebird – Stack Overflow