Re: PDO user question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Stowe wrote:
How are you using the number?  Probably the easiest way is to utilize PDOStatement::FetchAll() and then do a count() on that result set.

There are two things to bear in mind here. Often you are only displaying a subset of records - ten per page perhaps - and so a count of the total helps to populate the navigation tools. COUNT(*) is not the most efficient way of doing that when dealing with large numbers of records, and so keeping a table with a set of counters that are populated via triggers on insert and delete help to speed up that process. FetchAll() should then always produce a full set of records except for the last page ...

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux