On May 26, 2010, at 4:11 AM, Thomas D. wrote:

In theory, PDO should be much slower than ext/mysql or mysqli is. For example PDO will prepare everything.


I wrote the following on the February thread with Ulf Wendel that you linked to, but I think it bears repeating:

MySQLPerformanceBlog.com did some benchmarks in an article about "Prepared Statements" (http://www.mysqlperformanceblog.com/2006/08/02/mysql-prepared-statements/ ).

Peter Zaitsev wrote:
> I’ve done a simple benchmark (using SysBench) to see performance of
> simple query (single row point select) using standard statement,
> prepared statement and have it served from query cache. Prepared
> statements give 2290 queries/sec which is significantly better than
> 2000 with standard statements but it is still well below 4470
> queries/sec when results are served from query cache.

Peter seems to say that the "overhead" of using prepared statements is that they are 14.5% *faster* than using a non-prepared query execution, at least in this simple test. I'd expect the relative difference probably diminishes with a more complex query or a larger result set.

In any case, we should be careful about citing round-trips as a significant performance factor, because it discourages people from using prepared queries when they should.

Regards,
Bill Karwin

Reply via email to