Skip to content

Displaying millions of records with row count

Our recommended approach is always to set pagecount to false for very large dataset. This is because most users won't care how many rows that matched, they just need the top few records in the first a few pages, like Google search never shows number of records that match a specific search.

If one must show row counts in a large table with millions of records, a good technique is to use cache table. 

Overrwite num_rows() function in cls_db.php, currently it has

return $result->RecordCount();

which is an expensive operation that does row scan, especially with very large tables; instead, read it from a separate table that stores the rows count. So you keep a  separate table that tracks total number rows at all time. Use a Sql trigger that does increment or decrement when insert or delete.   

Feedback and Knowledge Base