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 the MGA (multi-generational architecture) 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
See also:
- [WayBack]Select count(*) is slow
- [WayBack] [#CORE-3666] Count command too slow – Firebird RDBMS Issue Tracker
- [WayBack] Robert Haas: Fast Counting (as PostgreSQL uses a similar architecture)
–jeroen






Leave a comment