First trials of benchmarking MySQL/Python DB interfaces

Is there a performance penalty using a pure Python database interface? Yes there is. But how much? .. also depends on who wrote it.

I started implementing some benchmarking for MySQL Connector/Python. Main reason is to identified bottlenecks or just plain bad coded. Another reasons: it’s cool and the question was raised during my talk at FOSDEM and also online.

Oh, yes, MySQL Connector/Python ain’t fast right now. Just compare a script spawning 10 threads opening 1000 connections. It indeed just connects.

mysql.connector 0.1.3-devel average: 0.0091820
MySQLdb 1.2.3c1             average: 0.0026477
oursql 0.9.1                average: 0.0007394

(MacOSX 10.6.2, MySQL 5.1.42, Python 2.6.1)

I’m not surprised with how bad Connector/Python did. I’m more intrigued by how oursql is performing compared to MySQLdb. Nice!

Well, it’s a start. Now off for a walk!

Comments

Seun Osewa
It would be far, far more interesting to compare performance with identical queries.
Geert Vanderkelen
Those test back then were indeed just opening a connection. No queries were involved.