News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Gonzalo Ayuso's Blog:
Performance analysis using bind parameters with PDO and PHP
October 06, 2010 @ 08:57:02

Gonzalo Ayuso has posted the results of some performance testing he did with bind parameters in a PDO-based request for his application.

Some months ago a work mate asked me for the differences between using bind variables versus executing the SQL statement directly as a string throughout a PDO connection. Basically the work-flow of almost all database drivers is the same: Prepare statement, execute and fetch results. [...] What's the best one? Both method work properly. The difference is how databases manage the operation internally.

He gives two code examples, one with the bind parameters and one without, and the benchmark code he used to generate his statistics. It uses a PDO connection to execute several statements in a row both with bind parameters and without, measuring the time (with microtime) and outputting the results. His results show that while the simple update is faster, the bind parameter method has the added benefit of reusability for multiple queries.

0 comments voice your opinion now!
performance bind parameters pdo analysis benchmark


blog comments powered by Disqus

Similar Posts

Ilia Alshanetsky\'s Blog: Frankfurt Conference

Zend Developer Zone: Zend Framework application's PHPUnit suite 3x faster

Ilia Alshanetsky\'s Blog: php|tek 2006

Gonzalo Ayuso's Blog: Performance analysis using bind parameters with PDO and PHP

DevShed: 7 PHP Frameworks Tested For Speed - Benchmarking PHP Frameworks


Community Events

Don't see your event here?
Let us know!


release api xdebug framework install laravel5 community laravel example series podcast voicesoftheelephpant opinion extension unittest php7 interview introduction library language

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework