4번독수리의 둥지

MySQL Covering index 본문

Database/MySQL

MySQL Covering index

4번독수리 2017. 9. 19. 10:38

http://gywn.net/2012/04/mysql-covering-index/



create table usertest (
 userno int(11) not null auto_increment,
 userid varchar(20) not null default '',
 nickname varchar(20) not null default '',
 .. 중략 ..
 chgdate varchar(15) not null default '',
 primary key (userno),
 key chgdate (chgdate)
) engine=innodb;

위 테이블에서

select *
from usertest
where chgdate like '2010%'
limit 100000, 100

vs

select a.*
from (
      select userno
      from usertest
      where chgdate like '2012%'
      limit 100000, 100
) b join usertest a on b.userno = a.userno


'Database > MySQL' 카테고리의 다른 글

_general_ci Versus _unicode_ci Collations  (0) 2022.12.29
MySQL DATE_ADD() vs php strtotime()  (0) 2016.09.21
SQL JOIN  (0) 2016.02.24
Select tables optimized away  (0) 2015.10.23
Correct indexing when using OR operator  (0) 2015.09.08