Re: paging methodology
| From: | John W. Holmes | Date: | Wed, 05 May 2004 19:06:09 +0000 |
| Subject: | Re: paging methodology | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-185476@lists.php.net to get a copy of this message | ||
From: "Chris W. Parker" <cparker@swatgear.com>
> do you know if that's any faster than doing a "SELECT COUNT(*) FROM
> table WHERE ..." ?
I did a couple (unscientific) tests and there doesn't seem to be much of a
difference. I'd use the COUNT(*) method just because it's more portable,
though.
---John Holmes...
mysql> select count(id) from status_history where date between
20040101000000 AND 20040501000000;
+-----------+
| count(id) |
+-----------+
| 27791 |
+-----------+
1 row in set (0.13 sec)
mysql> select * from status_history where date between 20040101000000 AND
20040501000000 LIMIT 2000,100;
100 rows in set (0.02 sec)
mysql> select SQL_CALC_FOUND_ROWS * from status_history where date between
20040101000000 AND 20040501000000 LIMIT 2000,100;
100 rows in set (0.14 sec)
mysql> select found_rows();
+--------------+
| found_rows() |
+--------------+
| 27791 |
+--------------+
1 row in set (0.00 sec)