Performance Issues of MySQL with Python

Larry Bates lbates at syscononline.com
Wed Feb 9 08:53:55 EST 2005


Wow, you give us too much credit out here.  From your
post we can't determine anything about what you plan
to do (how is your data structured, how much data do
you have, can it be indexed to speed up searching...).

Python and MySQL work together beautifully.  ANY SQL
database's performance is more about properly defining
the tables and indexes where appropriate than about
language uses to it.  You can write compiled C (or any
other language for that matter) that calls a poorly
designed database that gets terrible performance.  A
well thought out database structure with good choices
for indexes can give you outstanding performance when
called from any language.  Ultimately it comes down
to building a SQL query and passing it to the SQL
database and getting back results.  Front end language
isn't all that important (unless you must post-process
the data in the program a lot).  It is not uncommon
to get 100x or 1000x speed increases due to adding
proper indexes to tables or refactoring master-detail
table relationships in any SQL database.  You can't
get that by changing languages or even purchasing
faster hardware.

MySQL is particularly good when your read operations
outnumber your writes.  US Census Bureau uses MySQL
because they have static data that gets read over and
over (even though my understanding is that they have
an Oracle site license).  Databases that are transaction
oriented (e.g. accounting, etc.) can sometimes benefit
from the highly transactional nature of an Oracle or
DB2 or Postgres.  Later versions of MySQL have added
transactions, but the support is IMHO a step behind
the big guys in this area.  Also, if you want to be
highly scalable so as to provide for clustering, of
database servers, etc.  MySQL doesn't do that well
in this area, YET.

I hope my random thoughts are helpful.

Larry Bates


sandy wrote:
> Hi All,
> 
> I am a newbie to MySQL and Python. At the first place, I would like to
> know what are the general performance issues (if any) of using MySQL
> with Python.
> 
> By performance, I wanted to know how will the speed be, what is the
> memory overhead involved, etc during database specific operations
> (retrieval, update, insert, etc) when MySQL is used with Python.
> 
> Any solutions to overcome these issues (again, if any)?
> 
> Thanks and Regards,
> Sandeep
> 



More information about the Python-list mailing list