简体   繁体   English

MyIsam表级别锁定/死锁

[英]MyIsam table level locking / deadlock

I having different list of tables apart of that one table is type of InnoDb and others are MyIsm type. 我有不同的表列表,除了一个表是InnoDb类型,其他表是MyIsm类型。

My problem is, I am not getting any response on my website. 我的问题是,我的网站上没有任何回复。 When I check process list on MySql I found that : 当我在MySql上检查进程列表时,我发现:

在此处输入图片说明

A table having list of all question that sending data , some other process in waiting to update question's column and some other process in waiting to insert data in same table. 一个具有发送数据的所有问题的列表的表,等待更新问题列的其他过程以及等待在同一表中插入数据的其他过程。

This table contains list of question. 该表包含问题列表。 The type is MyIsam . 类型是MyIsam。 The size of table is about 5 GB. 表的大小约为5 GB。

How can I resolve that? 我该如何解决?

There are a couple of solutions for this, some may apply, some not. 有两种解决方案,有些可能适用,有些则没有。

  1. Add indexes to some columns 向某些列添加索引
  2. Change database type to innoDB 将数据库类型更改为innoDB
  3. Take a look at your query and improve the performance 查看您的查询并提高性能

When you add indexes to you table the lookup will be much faster and therefor the table lock won't be as long. 当您向表中添加索引时,查找将更快,因此表锁定将不再那么长。

When you change your database type to InnoDB the lock will only affect the row(s) the query is using, so other rows are still available for other query's 当您将数据库类型更改为InnoDB ,锁将仅影响查询所使用的行,因此其他行仍可用于其他查询

In your query itself most of the times a lot of performance can be gained by removing unnecessary joins or order by clauses. 在查询本身中的大多数情况下,通过删除不必要的joinsorder by子句可以提高性能。 Maybe you can use temporary tables instead of multiple subselects , etc... 也许您可以使用临时表来代替多个子subselects ,等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM