Experiment Detail

MySQL Performance Monitoring

2026. 11. 18.

● System Ready

Experiment Detail Information

상품 카테고리 조회 성능 비교

상품 테이블에서 특정 카테고리에 해당하는 데이터를 조회하고, 카테고리 컬럼에 인덱스를 적용하기 전후의 쿼리 실행 시간과 실행 계획을 비교한다.

SQL Query

Query 1

SELECT * FROM product WHERE category = '하의';

Query 5

select * from product where category = '상의';

Index Condition

Registered Index Conditions

Query 1 - Condition 1

인덱스 미적용

Query 1 - Condition 2

인덱스 적용

테이블명: product

인덱스명: idx_product_category

인덱스 컬럼: category

Query 5 - Condition 11

인덱스 미적용

Query 5 - Condition 12

인덱스 적용

테이블명: product

인덱스명: idx_product_category

인덱스 컬럼: category

Query 1

구분 평균 실행 시간 중앙값
Before 210.87 ms 200.69 ms
After (Condition 2) 195.09 ms 188.93 ms

Query 5

구분 평균 실행 시간 중앙값
Before 308.69 ms 308.62 ms
After (Condition 12) 303.77 ms 299.94 ms

Query 1

구분 1회차 2회차 3회차 4회차 5회차
Before 247.52 ms 199.75 ms 206.19 ms 200.69 ms 200.21 ms
After (Condition 2) 220.66 ms 188.75 ms 189.89 ms 188.93 ms 187.22 ms

Query 5

구분 1회차 2회차 3회차 4회차 5회차
Before 316.19 ms 308.62 ms 311.00 ms 306.38 ms 301.25 ms
After (Condition 12) 321.69 ms 298.45 ms 297.88 ms 299.94 ms 300.88 ms

Query 1

Before

EXPLAIN
product
접근 방식 (type)

ALL

선택 인덱스 (key)

없음

예상 행 수 (rows)

49769

필터 비율 (filtered)

10.0%

상세 실행 계획 정보
SELECT ID (id)

1

SELECT 유형 (select_type)

SIMPLE

파티션 (partitions)

없음

인덱스 길이 (key_len)

없음

참조 값 (ref)

없음

가능한 인덱스 (possible_keys)

없음

추가 정보 (Extra)

Using where

EXPLAIN ANALYZE
-> Filter: (product.category = '하의')  (cost=5065 rows=4977) (actual time=12.7..32.8 rows=12500 loops=1)
    -> Table scan on product  (cost=5065 rows=49769) (actual time=0.144..26.8 rows=50000 loops=1)

After (Condition 2)

EXPLAIN
product
접근 방식 (type)

ref

선택 인덱스 (key)

idx_product_category

예상 행 수 (rows)

22912

필터 비율 (filtered)

100.0%

상세 실행 계획 정보
SELECT ID (id)

1

SELECT 유형 (select_type)

SIMPLE

파티션 (partitions)

없음

인덱스 길이 (key_len)

82

참조 값 (ref)

const

가능한 인덱스 (possible_keys)

idx_product_category

추가 정보 (Extra)

없음

EXPLAIN ANALYZE
-> Index lookup on product using idx_product_category (category='하의')  (cost=2556 rows=22912) (actual time=0.51..19.5 rows=12500 loops=1)

Query 5

Before

EXPLAIN
product
접근 방식 (type)

ALL

선택 인덱스 (key)

없음

예상 행 수 (rows)

49769

필터 비율 (filtered)

10.0%

상세 실행 계획 정보
SELECT ID (id)

1

SELECT 유형 (select_type)

SIMPLE

파티션 (partitions)

없음

인덱스 길이 (key_len)

없음

참조 값 (ref)

없음

가능한 인덱스 (possible_keys)

없음

추가 정보 (Extra)

Using where

EXPLAIN ANALYZE
-> Filter: (product.category = '상의')  (cost=5065 rows=4977) (actual time=0.157..33.9 rows=20000 loops=1)
    -> Table scan on product  (cost=5065 rows=49769) (actual time=0.153..27 rows=50000 loops=1)

After (Condition 12)

EXPLAIN
product
접근 방식 (type)

ref

선택 인덱스 (key)

idx_product_category

예상 행 수 (rows)

24884

필터 비율 (filtered)

100.0%

상세 실행 계획 정보
SELECT ID (id)

1

SELECT 유형 (select_type)

SIMPLE

파티션 (partitions)

없음

인덱스 길이 (key_len)

82

참조 값 (ref)

const

가능한 인덱스 (possible_keys)

idx_product_category

추가 정보 (Extra)

없음

EXPLAIN ANALYZE
-> Index lookup on product using idx_product_category (category='상의')  (cost=2753 rows=24884) (actual time=0.534..32.3 rows=20000 loops=1)