MySql中左连接查询突然变得很慢

 

表结构:

A表

userId,name

B表

wId,userId,address

A表左连接B表查询时,平时查询都非常的块,这几天突然变得很慢。

一个查询花了0.888S。

使用explain表达式查询,发现了问题。

提示:

Using where; Using join buffer (Block Nested Loop)

看了一下数据,几乎是全表搜索。

添加了索引之后提示:

Using where; Using index

查询使用了0.029S。

 

相关文章:

  • 2022-12-23
  • 2021-09-23
  • 2021-11-04
  • 2021-12-26
  • 2021-12-05
  • 2021-12-24
  • 2021-04-30
  • 2021-08-06
猜你喜欢
  • 2022-01-23
  • 2021-12-26
  • 2021-12-26
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案