MYSQL: InnoDB and Django transactions
- Always use InnoDB
my.cnf
:
[mysqld]
default-storage-engine = InnoDB
- InnoDB for session:
SET storage_engine=INNODB
- InnoDB per table:
CREATE TABLE employee (id INT) ENGINE = InnoDB;
ALTER TABLE employee ENGINE = InnoDB;
Also it is important to change isolation level. Because with REPEATABLE READ if the first read yield no result, any subsequent read, as it must yield the same result, won't yield anything too.
my.cnf:
# Set the default transaction isolation level.
transaction-isolation = READ-COMMITTED
Django:
DATABASE_OPTIONS = { "init_command": "SET storage_engine=INNODB, SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED", }
Comments
comments powered by Disqus