Re: [metabase-dev] RE: [PEAR-DEV] Re: [binarycloud-dev] FW: letstalk "metapear" - politics aside:-)
| From: | John Lim | Date: | Tue, 19 Mar 2002 17:06:28 +0000 |
| Subject: | Re: [metabase-dev] RE: [PEAR-DEV] Re: [binarycloud-dev] FW: letstalk "metapear" - politics aside:-) | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5041@lists.php.net to get a copy of this message | ||
> Query caching: Some databases, like Oracle, have a cache of parsed and
> optimized queries. By using prepare(), the database will need to parse
> and optimize your query just once instead of every time you execute it.
> This can be a really big speedup.
>
Hi Stig,
Strangely enough, I recently benchmarked binding of variables and got some
strange results. They were 6 times slower than sending pure sql.
For more details, see:
http://php.weblogs.com/oracle_mysql_performance
John Lim
>>>>>>> Not using bind variables (MySQL and Oracle), using ADOdb library:
$DB->BeginTrans();
for ($i=0; $i < $NUMRECS; $i++) {
$DB->Execute(
"insert into test5000 (name,price,stock) values ('a name
$i',$i,$i)");
}
$DB->CommitTrans();
>>>>>>>>>> Using bind variables, using OCI calls directly for max
>>>>>>>>>> speed:
$DB->BeginTrans();
$a = '';
$b = 0;
$c = 0;
$stmt = OCIParse($DB->_connectionID,
"insert into test5000 (name,price,stock) values (:a,:b,:c)");
OCIBindByName($stmt,":a",&$a,32);
OCIBindByName($stmt,":b",&$b,32);
OCIBindByName($stmt,":c",&$c,32);
for ($i=0; $i < $NUMRECS; $i++) {
$a = "a name $i";
$b = $i;
$c = $i;
$e = OCIExecute($stmt);
if (!$e) {
print $DB->ErrorMsg();
break;
}
}
$DB->CommitTrans();