Re: PDO::prepare deallocate & PDOStatement::closeCursor()

From: Date: Sat, 16 Dec 2006 01:50:54 +0000
Subject: Re: PDO::prepare deallocate & PDOStatement::closeCursor()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-245874@lists.php.net to get a copy of this message
On Fri, December 15, 2006 7:49 am, Yonatan Ben-Nes wrote: > 1. Let's say that I create the following prepared statement: > $PDOStatement = $DB_Conn->prepare("INSERT INTO test (name) values > (?)"); > And after 50,000 inserts (with > $PDOStatement->execute(array('somevalue'));) > I want the database to analyze, compile and optimize it's plan again > so it > will be more efficient for it's next inserts (actually is that true at > all?!?), does repeating the same command will deallocate the prepared > statement at the database & replace it with the new prepared > statement? (new > plan). > If not, how can I deallocate it then? I *think* you will find that the change in plan for an insert will not change drastically as you insert -- Rather, the change in plan will change for a SELECT if you optimize/analyze/etc. Based on the $PDOStatement being a result object, I would *expect* it to survive an analysis query on the same connection, but you'll have to test to be sure. > 2. At the PHP manual of PDOStatement::closeCursor it's written that > "This > method is useful for database drivers that do not support executing a > PDOStatement object when a previously executed PDOStatement object > still has > unfetched rows. If your database driver suffers from this limitation, > the > problem may manifest itself in an out-of-sequence error.". > Anyone know if the PostgreSQL suffer from this problem or not? The PostgreSQL developers will probably answer this one way more faster. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#245874) next »