小编Rub*_*con的帖子

MySQL用LOCK=NONE创建索引仍然锁定表

我有以下 MySQL RoR 迁移:

class ReindexRpushNotification < ActiveRecord::Migration
  def up
    execute("DROP INDEX `index_rpush_notifications_multi` ON rpush_notifications;")
    execute("ALTER TABLE rpush_notifications ADD INDEX index_rpush_notifications_multi (delivered, failed, processing, deliver_after), ALGORITHM=INPLACE, LOCK=NONE;")
  end

  def down
    execute("DROP INDEX `index_rpush_notifications_multi` ON rpush_notifications;")
    execute("ALTER TABLE rpush_notifications ADD INDEX index_rpush_notifications_multi (delivered, failed), ALGORITHM=INPLACE, LOCK=NONE;")
  end
end
Run Code Online (Sandbox Code Playgroud)

在这次迁移期间,我正在尝试执行一些请求(GET、COUNT、DELETE、UPDATE)但没有任何效果,所有这些请求都在等待

我在这里找到了有关在后台创建索引的信息

/sf/answers/2524494031/

http://dev.mysql.com/doc/refman/5.6/en/innodb-create-index-overview.html

但它对我们不起作用

有人试过LOCK=NONE吗?

我们在 AWS RDS 上使用 MySQL 5.6.23

mysql mysql-5.6 rails

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

mysql ×1

mysql-5.6 ×1

rails ×1