|ADOdb Library for PHP Manual
If the database driver API does not support counting the number of records
returned in a SELECT statement, the function RecordCount() is emulated when
the global variable $ADODB_COUNTRECS is set to true, which is the default. We
emulate this by buffering the records, which can take up large amounts of memory
for big recordsets. Set this variable to false for the best performance. This
variable is checked every time a query is executed, so you can selectively choose
which recordsets to count.