I did a profiling of my python program and noticed that they were a lot of calls to commit and they took a lot of time.
Is it better performance wise to do :
db = MySQLcb.connect(...)
c = db.cursor(...)
c.execute('INSERT...)
c.commit()
c.execute('INSERT...)
c.commit()
or
db = MySQLcb.connect(...)
c = db.cursor(...)
c.execute('INSERT...)
c.execute('INSERT...)
c.commit()
Knowing that I am making a lot of inserts (thousands).
connect(). And for many inserts into same table, look intoexecutemany.