On Feb 24, 2010, at 11:57 AM, Ulf Wendel wrote:
As you can see, you already got two round trips from the client to the server versus one above.

Are you sure the round-trips are a strong determiner for query performance?

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