DB - Query(limit) vs. LimitQuery() in MySQL
| From: | Tommy Ipsen | Date: | Mon, 27 Sep 2004 11:01:42 +0000 |
| Subject: | DB - Query(limit) vs. LimitQuery() in MySQL | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-14648@lists.php.net to get a copy of this message | ||
Hi group
I'm using the DB-package in PEAR and was wondering which of the two approaches are most efficient:
$res->Query('SELECT * FROM table LIMIT a, b');
$res->LimitQuery('SELECT * FROM table', a, b);
I'm using MySQL as DBMS giving me the option to use LIMIT directly in the query which is quite efficient since I don't have to retrieve all the rows in the table - at least this is what I think is the case :-)
The problem is that I'm using the DB package to provide portability and allow me to more easily switch the DBMS if it becomes necessary and I don't know if MySQL's way of using LIMIT is "industry-standard"?
Does LimitQuery take advantage of MySQLs features when executing the query?
To sum all of the above up:
Which one should I use and what are the pros and cons of the methods?
Cheers, Tommy Ipsen