Hi,

I thought that this might be of interest:

http://fr3.php.net/manual/en/function.PDO-prepare.php#79178

--
Laurent Melmoux - [EMAIL PROTECTED]
Annecy - France



Christian Ehmig a écrit :
Hi!

Some time ago I noticed that Zend_DB and especially Zend_Db_Adapter_Abstract
prepare ANY statement except when you use the following code fragment:

$result = $db->getConnection()->exec('DROP TABLE bugs');

The methodology of preparing each statement is necessary for Oracle as far
as I remember. Regarding MySQL it has a huge impact on performance instead!
The one and only time you need to prepare a statement in MySQL is if you use
the prepared query several times with different values bound to the ?
parameters.
I compared the Zend:DB MySQL adapters to ADO, Pear and Native PHP code
inserting 100.000 rows.

Code looked something like this:

for ($i = 0; $i < 100.000; $i++) {

$data = array(
    'text' => 'somedummytext'
);

$db->insert('testtable', $data);
}

Now, the Zend MySQL adapters send 200.000 queries to the mysql server in
this case, a "prepare & execute" for each call to $db->insert().

This resulted in double execution time compared to native php access in
other words a performance drop of 100%! Of course, SELECT statements
(fetchRow, fetchAll, etc.) are prepared, too. Just imagine you use around
100 select queries to render a site - each select will be individually
prepared, although this is completely nonsense in my opinion.

Are there any plans for disabling the "automatic prepare feature" or any
other hints on this issue?







Reply via email to