MySQLdb slow on MySQL 5

Gerhard Häring gh at ghaering.de
Thu Feb 23 14:06:22 EST 2006


timothy.williams at nvl.army.mil wrote:
> Hi.
> 
> I have a Python program that parses a file and inserts records into a
> database with MySQLdb. I recently upgraded to MySQL 5.0.8, and now my
> parser runs *really* slow. Writing out to CSV files is fine, but when I
> try to insert the same records in a MySQL5 database, it slows to a
> crawl. Using MySQL 4.1 seems fine. The data seems to be inserted
> correctly, it's just really slow.
> 
> Has anyone else noticed a similar problem using MySQL5 and MySQLdb?

Maybe you're running in autocommit mode. I. e. an implicit COMMIT is 
done for each insert. This slows any database down.

Or are you calling commit() yourself too often?

-- Gerhard



More information about the Python-list mailing list