mySQL access speed

Dikkie Dik dikkie at nospam.org
Mon Nov 16 17:28:35 EST 2009


> ... But it isn't very fast.
> For executemany I have some hundred thousend lines in a list of tuples.
> I joined() these lines to form an insert into table values (....) statement and
> blew it into the mysql cmdline client via os.popen().
> This was 60(!) times faster and loaded my table in seconds!
> 
> Is the mySQL module so slow ?


No. The fact that each statement is atomic makes it slow. Try the
multiple queries, but precede them with a "SET AUTOCOMMIT=0" statement
or use a transaction. You will probably see a tremendous speed increase.

When you combine all the queries into one statement, you are effectively
doing the same.

Best regards,
Dikkie.



More information about the Python-list mailing list