RE: [PEAR-DEV] MDB slower than DB ?
| From: | Lukas Smith | Date: | Fri, 13 Dec 2002 13:28:01 +0000 |
| Subject: | RE: [PEAR-DEV] MDB slower than DB ? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-11609@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Bertrand Mansion [mailto:bmansion@mamasam.com]
> Sent: Friday, December 13, 2002 2:12 PM
> To: smith@dybnet.de; pear-dev@lists.php.net
> Subject: Re: [PEAR-DEV] MDB slower than DB ?
>
> le 13/12/02 13:41, Lukas Smith à smith@dybnet.de a écrit :
>
> > Hi,
> >
<snip>
> >
> > I would be interested in your specific benchmark or any observations
you
> > might have.
>
> The code I use makes a lot of $db->getOne($query) and the queries
contains
> mostly count(*). This is for a statistics page.
>
> Actually, there's only one fetchRow for just one row returned.
> This was made with the mysql wrapper.
>
> Could this be slower because of getOne() ?
PEAR::DB does something very uncouth in the get*() methods:
The methods are very long instead of separating the different task into
smaller methods. MDB uses the fetch*() methods in its get*() methods to
make the code easier to read and maintain. Obviously this adds another
function call. So maybe its another case of maintainability vs.
performance.
If you do not intent to pass a prepared query to getOne() then probably
what you really want to use is queryOne() which is slightly lighter than
getOne() since it does not allow you to pass prepared query parameters.
So maybe you will be able to regain some of your lost performance using
queryOne().
The applies for all other get*() methods as well: if you dont want to
use prepared queries with it rather use query*() ...
Finally MDB has a larger memory footprint for obvious reasons which can
obviously fill up your memory faster but if that would happen
performance would probably be very miserable for you.
Regards,
Lukas