How to check what query caused the lock

61

I think show processlist; is the best way to start debugging this problem. show processlist shows which threads are running and their state.

You might use the Explain command as well, especially in your most common queries. This will show the execution plan for the queries you want. Possibly, some of the queries have no indexes or are not using them properly.

On the other hand, you're probably using MyISAM storage engine. If you don't need full text searches (or other MyISAM specific features), I'd recommend you to migrate to InnoDB, which provides row based locks instead of locking the entire table, among other features, which will probably improve the performance of your MySQL. Here's a nice comparison between MyISAM and InnoDB.

Possibly, you also need to tune some of your MySQL variables. I'd recommend you to tune key_buffer_size, which is the size of the buffer used for index blocks. Tweak this to at least 30% of your RAM or the re-indexing process will probably be too slow.

Last but not least, enable the slow query log. This will show which queries are taking too much time to run.

Hope this helps!

Share:
61

Related videos on Youtube

fireboy0526
Author by

fireboy0526

Updated on September 18, 2022

Comments

  • fireboy0526
    fireboy0526 over 1 year

    I'm new to the whole Google Developer console thing. Right now I can get the server to sync with Git and fetch a copy when ever there's a push to it. However, I'm trying to build and test the program with Maven-Android-Plugin and no matter what I've tried, i'll always get this error:

    Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1.1 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-compiler-plugin:jar:3.1.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

    With the compute engine that I've got, I've installed mavven 3.1.1 and have also installed java sdk 1.7. I have used the console command $JAVA_HOME and mvn-v and both are showing the right versions.

    Is there something else I need to setup to get it to work correctly?

    Thanks in advance

    Edit: The compute-engine that I've selected is Maven Junit test.