Benchmarking SQL drivers

"Stephen R. van den Berg" <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
Well, now that the dust has settled, it was/is time to compare the results
with other drivers:

I ran a benchmark over a table with 1163 entries, 10 columns.
Where a (very straightforward) SELECT pulls 166 of those entries out,
returning two columns.  The intent is to benchmark the driver, not the
quality of the SQL engine.
I open a single connection to the database.
I run 10 queries in rapid succession (big_query), fetch
all results using fetch_row().
And run those 10 queries in a loop for 394 times.

What I measure is throughput to/from the database, the queries probably
are IO-bound (they fit in the database cache) by the network(latencies).  The
database is on a different machine on the same ethernet.

11.3s  pgsql    Pike 8.1 (new driver, multithreaded)
17.3s  MySQL    Pike 8.1
18.4s  pgsql    Pike 7.8 (old driver, single threaded)
32.7s  postgres Pike 8.1 (C-libpq)

MySQL daemon runs 5.5.39.
PostgreSQL server runs 9.3.4.

Running the tests multiple times shows a variation of the timings
of less than 1%.  The database server was idle most of the time.

Running multiple queries at the same time over the same connection will
likely reveal that you can run (up to a certain amount) multiple queries
simultaneously without consuming extra wallclock time.
However since the other three drivers do not support that, a comparison
benchmark will be pointless.
-- 
Stephen.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.