Re: Turtle slow bind variables are 6 times slower in Oracle?

From: Date: Wed, 20 Mar 2002 06:38:03 +0000
Subject: Re: Turtle slow bind variables are 6 times slower in Oracle?
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-17773@lists.php.net to get a copy of this message
Found out why it was so slow. > $e = OCIExecute($stmt); The above commits every insert. It should be changed to > $e = OCIExecute($stmt,OCT_DEFAULT); Then I got the expected results. Using bind vars is nearly twice as fast. "John Lim" <heyjohnlim@yahoo.com> wrote in message news:20020316065223.92914.qmail@pb1.pair.com... > Hello, > I recently benchmarked using bind variables for inserts versus sending > simple sql over to oracle 8.1.7. Surprisingly, sending simple sql was > nearly 6 times faster. My database is using cursor_sharing=force. > > Can anyone else verify this? > > >>>>>>> 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: > > $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(); > > --- > For more details, see: > http://php.weblogs.com/oracle_mysql_performance > > > >

« previous php.db (#17773) next »