Bug #72979 mysql.connector is much slower than MySQLdb
Submitted: 12 Jun 2014 7:43 Modified: 18 Jun 2014 9:41
Reporter: Chengyao Jiang Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / Python Severity:S5 (Performance)
Version: OS:Any
Assigned to: CPU Architecture:Any

[12 Jun 2014 7:43] Chengyao Jiang
Description:
I use python to write a simple multi-thread benchmark tools for my application. I notice that when I use Oracle mysql.connector, the QPS is only ~800. But when I switch to use MySQLdb to connect MySQL, the QPS can up to ~7000QPS.

As for the test, it just selects data by primary key. I use the table generated by sysbench. And all the data has been put to InnoDB buffer pool by warm up before test.

I've tested it in OSX and Linux, the behave is the same.

How to repeat:
write a benchmar, compare it with Oracle mysql.connector and MySQLdb API
[18 Jun 2014 9:41] Geert Vanderkelen
Hi Jiang David,

The MySQLdb Python package uses the MySQL C client libraries. Connector/Python is pure Python, nothing written in C or linking C libraries. You can't really compare a pure Python module with our MySQL C client libraries when it comes to performance.

That said, we always try to improve the pure Python code. You did not specify the version of Connector/Python you used, but make sure to get the latest.

I'm closing BUG#72979 as 'Not a Bug' as improving performance is something we continuously work on.

Cheers,
Geert