In a Django program, how to explicitly disable auto transaction management before hundreds of UPDATEs and enable it after the UPDATEs finish?
I looked into http://docs.djangoproject.com/en/dev/topics/db/transactions/ but didn't find any clue.
I tried to put the following code at the beginning
settings.DISABLE_TRANSACTION_MANAGEMENT = True
I also tried
cursor = connection.cursor()
cursor.execute('SET SESSION autocommit = 0;')
...
UPDATE
...
cursor.execute('SET SESSION autocommit = 1;')
Neither methods above improved the updating speed. Is there anything wrong with above codes?