Link to home
Start Free TrialLog in
Avatar of el930692
el930692

asked on

Lots of locked state mysql inserts - slow updates and selects

For some reason all the time when on my processes send selects and updates to a mysql table I see a lot of  inserts to the same table in the locked sate.

That makes the initial selects and updates very slow like 40 seconds to a minute for every select or update.

How can I fix this?
Avatar of wolfgang_93
wolfgang_93
Flag of Canada image

You probably are using the default storage engine type MyISAM which tends to do a poor job with locking tables from other users. Turn your tables into InnoDB which ensures much better locking management (e.g. lock only rows being updated, don't lock entire table when doing a query on it, etc.)

Say your table is called "fubar", here is a simple command to turn it into InnoDB (assuming you have InnoDB configured for your MySQL server):

  alter table fubar engine=innodb
Avatar of el930692
el930692

ASKER

Can you have mixed table types like MyISAM and InnoDB?
The majority of my tables are MyISAM.
ASKER CERTIFIED SOLUTION
Avatar of wolfgang_93
wolfgang_93
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!