mysql条件应用or查询不会触发索引

WBOY
Release: 2016-06-13 12:39:57
Original
874 people have browsed it

mysql条件使用or查询不会触发索引?
说法是:where条件中出现了or,不会使用索引


我测试结果如下:

<br />
mysql> explain select * from emp where ename="dsleos" or ename="saesad" \G<br />
*************************** 1. row ***************************<br />
           id: 1<br />
  select_type: SIMPLE<br />
        table: emp<br />
         type: range<br />
possible_keys: e_i<br />
          key: e_i<br />
      key_len: 62<br />
          ref: NULL<br />
         rows: 2<br />
        Extra: Using where<br />
1 row in set (0.00 sec)<br />
Copy after login


触发了索引,,到底使用or会不会触发索引啊?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template