[BE] DB Indexing - woowacourse-teams/2021-zzimkkong GitHub Wiki
1. 인덱스 확인
show index from 테이블명;
2. 인덱스 생성
create index 인덱스명 on 테이블명(컬럼명);
alter table 테이블명 add index 인덱스명(컬럼명);
3. 인덱스 삭제 (수정 시에는 drop 후 재생성)
alter table 테이블명 drop index 인덱스명;
4. 인덱스 타는지 확인
- type 가 all이고 possible keys가 null이면
- type가 ref인 상태에서 possible_keys를 보면 해당 쿼리가 어느 인덱스를 타는지 확인이 가능
explain
select * from 테이블명 where name = ‘철수’;