mysql 唯一索引引发的死锁问题
MySQL优化器的解析与官方文档的差异
dev.mysql.com/doc/refman/8.0/en/wh...
中有提到A table that is used with a WHERE clause on a PRIMARY KEY or a UNIQUE index, where all index parts are compared to constant expressions and are defined as NOT NULL.
但是之前线上遇到一个,update … where unique_key=’’ and union_key1=’’ 使用了唯一索引和一个联合索引,居然走了index merge。而不是这里说首先读取唯一索引的常量值。这也导致了死锁问题。
现在疑惑的是,针对唯一索引,MySQL,到底是怎么优化的
难道对于多表是这样,单表不是