2009. 5. 29. 10:28 Programming
mysql index
1. 만들기
CREATE INDEX <인덱스명> ON <테이블명> ( 칼럼명1, 칼럼명2, ... );
create unique index index_name using btree on table_name ( name(10) ) ;
create index index_name on table_name ( id(10), name(30) );
2. 테이블 생성시 만들기
create table index_sample (
product_code char(10) not null,
product_name char(20) not null,
product_detail char(100) not null,
index (product_code) <---- product_code에만 인덱스 걸기
);
3. 테이블 생성시 2개 만들기
create table index_sample (
product_code char(10) not null,
product_name char(20) not null,
product_detail char(100) not null,
index (product_code, product_name) <---- product_code, product_name 두개에 인덱스 걸기
); and 조건으로 검색시에만 인덱스 활용
4. 인덱스 보기
show index from index_sample;
5. 인덱스 제거
drop index index_name on table_name
'Programming' 카테고리의 다른 글
FLEX 관련 (0) | 2009.08.18 |
---|