1.2 Dataset과 workload
Planner 실험에는 균일한 data만으로 충분하지 않습니다. 실제 workload에서 흔한 skew, column correlation, time range, hot subset을 dataset에 넣습니다.
Lab의 customers와 orders는 다음 특성을 가집니다.
- Customer마다 region이 고정돼 column correlation이 있습니다.
- Order status는
paid에 치우칩니다. - 최근 주문을 찾는 time range query가 있습니다.
- 소수 customer가 많은 주문을 만드는 skew가 있습니다.
SELECT status, count(*)
FROM orders
GROUP BY status
ORDER BY count(*) DESC;
SELECT customer_id, count(*)
FROM orders
GROUP BY customer_id
ORDER BY count(*) DESC
LIMIT 10;
Workload 정의
동일 SQL이라도 literal, prepared statement, concurrency, cache 상태에 따라 결과가 바뀝니다.
query:
parameter distribution:
concurrency:
duration:
cache state:
expected rows:
latency target:
한 개 parameter만 빠르게 만들고 전체 distribution을 악화시키지 않는지 확인합니다. 특정 tenant와 최근 날짜만 반복하면 index가 유리해 보여도 전체 workload에서는 write amplification이 더 클 수 있습니다.
Data size가 memory보다 작으면 storage plan 차이가 잘 드러나지 않습니다. Laptop Lab 결과를 production 절대 성능으로 옮기지 말고 plan 구조와 변화 방향을 학습합니다.