To avoid major changes in source code, we can provide a static method in
Zend_Db_Adapter_Abstract to enable/disable prepared queries.

 

 

-          enabled mode -> the statement way with automatic bindings with
PDO

-          disabled mode -> the “query” method can call the PDO->exec
replacing the bindings with a self-made function and quoting in-place the
parameters

 

To enable/disable the mode we can call something like :
$db->getAdapter()->usePrepared(false);

 

 

 

   _____  

De: Simon Mundy [mailto:[EMAIL PROTECTED] 
Enviado el: domingo, 09 de diciembre de 2007 0:36
Para: Christian Ehmig
CC: Zend Framework; Zend Framework DB
Asunto: [fw-db] Re: [fw-general] Zend_DB performance issue

 

Hi Christian

 

It's certainly worth pursuing - can you please create a new feature request
on the JIRA tracker - HYPERLINK
"http://framework.zend.com/issues/secure/Dashboard.jspa"http://framework.zen
d.com/issues/secure/Dashboard.jspa

 

Kind regards






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?





-- 
View this message in context: HYPERLINK
"http://www.nabble.com/Zend_DB-performance-issue-tp14233508s16154p14233508.h
tml"http://www.nabble.com/Zend_DB-performance-issue-tp14233508s16154p1423350
8.html
Sent from the Zend Framework mailing list archive at Nabble.com.

 

--

 

Simon Mundy | Director | PEPTOLAB

 

""" " "" """""" "" "" """"""" " "" """"" " """"" "  """""" "" "

 

PeptoLab will be closed:

Saturday 15th  December through until Monday 17th December 

Saturday 22nd December through until Wednesday 2nd January

For urgent requests, please call 0438 046 061

 

202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000

Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654 4124

HYPERLINK "http://www.peptolab.com"http://www.peptolab.com

 


No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.17/1179 - Release Date: 09/12/2007
11:06



No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.503 / Virus Database: 269.16.17/1179 - Release Date: 09/12/2007
11:06
 

Reply via email to