Skip to main content
1 of 3

MySQL lock on memory storage engine, when does apply?

I want to use MySQL MEMORY storage engine to handle my php session variables (actually I already implemented it but since all my tests are being done by a single user, me, I am unable to notice this).

As it says here: http://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.html

"MEMORY performance is constrained by contention resulting from single-thread execution and table lock overhead when processing updates. This limits scalability when load increases, particularly for statement mixes that include writes."

I don't understand this statement. It makes me think that when you insert/update/replace the table locks itself automatically and entirely so you will not be able to select anything while the write is being done. Is this correct? Can this be disabled? I need to write and read quite frequently and at the same time and I am not planning on doing transactions on this table:

CREATE TABLE sessions ( id varchar(255) NOT NULL, data varchar(64000) NULL, expires int(11) UNSIGNED DEFAULT NULL, PRIMARY KEY (id) )ENGINE=MEMORY;