Thx Adam But what if concurrent inserts are happening to the table while the users page-view thru the data. The count may change.
vikash -----Original Message----- From: Adam Erickson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 4:48 PM To: Vikash K Agarwal; [EMAIL PROTECTED] Subject: RE: getting a page of data and total count > What is the best way to get the total count as well as the paged > content. Do I need to fire two queries or is there a trick which can do > this in a single query? I'm doing this on tables with many millions of records. I take a hit once to get a total record count then cache that value in the user's session. Subsequent requests use that value instead of doing count(*) every load. LIMIT offset,number handles pagination very well IMO. Adam Erickson --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php