Snow Doggy
Snow Doggy

Reputation: 21

What is the fastest/most performant SQL driver for Python?

I know of PyMySQLDb, is that pretty much the thinnest/lightest way of accessing MySql?

Upvotes: 2

Views: 4359

Answers (3)

codersofthedark
codersofthedark

Reputation: 9645

MySQLDb is faster while SQLAlchemy makes code more user friendly -:)

Upvotes: 0

Lennart Regebro
Lennart Regebro

Reputation: 172249

The fastest is SQLAlchemy.

"Say what!?"

Well, a nice ORM, and I like SQLAlchemy, you will get your code finished much faster. If your code then runs 0.2 seconds slower isn't really gonna make any noticeable difference. :)

Now if you get performance problems, then you can look into improving the code. But choosing the access module after who in theory is "fastest" is premature optimization.

Upvotes: 4

SilverbackNet
SilverbackNet

Reputation: 2074

The lightest possible way is to use ctypes and directly call into the MySQL API, of course, without using any translation layers. Now, that's ugly and will make your life miserable unless you also write C, so yes, the MySQLDb extension is the standard and most performant way to use MySQL while still using the Python Database API. Almost anything else will be built on top of that or one of its predecessors.

Of course, the connection layer is rarely where all of the database speed problems come from. That's mostly from misusing the API you have or building a bad database or queries.

Upvotes: 3

Related Questions