운영 서버에서 DB index 적용 작업 진행

- 01~07 작업 문서를 운영 측정값 기준으로 정리 (문서의 DB 비밀번호 삭제)
- app_highest_record 중복 8,795행 점수 기준 정리, 인덱스 5개 + UNIQUE 키 2개 추가
- 02·04 공통 측정 스크립트와 측정 결과, comparison.txt 추가
- 서버 처리 시간 18~292배 단축, 결과 행 수 동일
- 운영 데이터 백업과 권한(비밀번호 해시) 파일은 커밋에서 제외

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 23:30:42 +09:00
parent ded12332d5
commit 03eea2098e
56 changed files with 6993 additions and 0 deletions
@@ -0,0 +1,356 @@
=== q1_hour_func ===
{
"query_optimization": {
"r_total_time_ms": 0.175154857
},
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 74.61373851,
"nested_loop": [
{
"read_sorted_file": {
"r_rows": 22,
"filesort": {
"sort_key": "best_record.RecordDateTime, best_record.PlayerID",
"r_loops": 1,
"r_total_time_ms": 74.59065391,
"r_used_priority_queue": false,
"r_output_rows": 22,
"r_buffer_size": "2047Kb",
"r_sort_mode": "sort_key,addon_fields",
"table": {
"table_name": "best_record",
"access_type": "index_merge",
"possible_keys": ["MaestroID", "AppID"],
"key_length": "4,4",
"index_merge": {
"intersect": [
{
"range": {
"key": "MaestroID",
"used_key_parts": ["MaestroID"]
}
},
{
"range": {
"key": "AppID",
"used_key_parts": ["AppID"]
}
}
]
},
"r_loops": 1,
"rows": 10103,
"r_rows": 5851,
"r_table_time_ms": 15.56706792,
"r_other_time_ms": 52.50187814,
"r_engine_stats": {
"pages_accessed": 17780
},
"filtered": 100,
"r_filtered": 0.376004102,
"attached_condition": "best_record.MaestroID = @maestro and best_record.AppID = @app and cast(best_record.RecordDateTime as date) = @`day` and hour(best_record.RecordDateTime) = 9"
}
}
}
}
]
}
}
=== q2_hour_range ===
{
"query_optimization": {
"r_total_time_ms": 0.183126443
},
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 75.58458171,
"nested_loop": [
{
"read_sorted_file": {
"r_rows": 22,
"filesort": {
"sort_key": "best_record.RecordDateTime, best_record.PlayerID",
"r_loops": 1,
"r_total_time_ms": 75.56186719,
"r_used_priority_queue": false,
"r_output_rows": 22,
"r_buffer_size": "2047Kb",
"r_sort_mode": "sort_key,addon_fields",
"table": {
"table_name": "best_record",
"access_type": "index_merge",
"possible_keys": ["MaestroID", "AppID"],
"key_length": "4,4",
"index_merge": {
"intersect": [
{
"range": {
"key": "MaestroID",
"used_key_parts": ["MaestroID"]
}
},
{
"range": {
"key": "AppID",
"used_key_parts": ["AppID"]
}
}
]
},
"r_loops": 1,
"rows": 10103,
"r_rows": 5851,
"r_table_time_ms": 15.67992038,
"r_other_time_ms": 53.82031051,
"r_engine_stats": {
"pages_accessed": 17780
},
"filtered": 100,
"r_filtered": 0.376004102,
"attached_condition": "best_record.MaestroID = @maestro and best_record.AppID = @app and best_record.RecordDateTime >= '2026-08-26 09:00:00' and best_record.RecordDateTime < '2026-08-26 10:00:00'"
}
}
}
}
]
}
}
=== q3_day_func ===
{
"query_optimization": {
"r_total_time_ms": 0.205960987
},
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 75.28739257,
"filesort": {
"sort_key": "max(best_record.BestRecord) desc, best_record.PlayerID",
"r_loops": 1,
"r_total_time_ms": 0.028745721,
"r_used_priority_queue": false,
"r_output_rows": 61,
"r_buffer_size": "1Kb",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "best_record",
"access_type": "index_merge",
"possible_keys": ["MaestroID", "AppID"],
"key_length": "4,4",
"index_merge": {
"intersect": [
{
"range": {
"key": "MaestroID",
"used_key_parts": ["MaestroID"]
}
},
{
"range": {
"key": "AppID",
"used_key_parts": ["AppID"]
}
}
]
},
"r_loops": 1,
"rows": 10103,
"r_rows": 5851,
"r_table_time_ms": 15.68132066,
"r_other_time_ms": 53.54159505,
"r_engine_stats": {
"pages_accessed": 17780
},
"filtered": 100,
"r_filtered": 1.692018458,
"attached_condition": "best_record.MaestroID = @maestro and best_record.AppID = @app and year(best_record.RecordDateTime) = 2026 and month(best_record.RecordDateTime) = 8 and dayofmonth(best_record.RecordDateTime) = 26"
}
}
]
}
}
}
}
=== q4_day_range ===
{
"query_optimization": {
"r_total_time_ms": 0.200909982
},
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 75.24298373,
"filesort": {
"sort_key": "max(best_record.BestRecord) desc, best_record.PlayerID",
"r_loops": 1,
"r_total_time_ms": 0.023154608,
"r_used_priority_queue": false,
"r_output_rows": 61,
"r_buffer_size": "1Kb",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "best_record",
"access_type": "index_merge",
"possible_keys": ["MaestroID", "AppID"],
"key_length": "4,4",
"index_merge": {
"intersect": [
{
"range": {
"key": "MaestroID",
"used_key_parts": ["MaestroID"]
}
},
{
"range": {
"key": "AppID",
"used_key_parts": ["AppID"]
}
}
]
},
"r_loops": 1,
"rows": 10103,
"r_rows": 5851,
"r_table_time_ms": 15.79226274,
"r_other_time_ms": 52.7619799,
"r_engine_stats": {
"pages_accessed": 17780
},
"filtered": 100,
"r_filtered": 1.692018458,
"attached_condition": "best_record.MaestroID = @maestro and best_record.AppID = @app and best_record.RecordDateTime >= '2026-08-26 00:00:00' and best_record.RecordDateTime < '2026-08-27 00:00:00'"
}
}
]
}
}
}
}
=== q5_month_func ===
{
"query_optimization": {
"r_total_time_ms": 0.213092406
},
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 76.26824776,
"filesort": {
"sort_key": "max(best_record.BestRecord) desc, best_record.PlayerID",
"r_loops": 1,
"r_total_time_ms": 0.069783887,
"r_used_priority_queue": false,
"r_output_rows": 262,
"r_buffer_size": "6Kb",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "best_record",
"access_type": "index_merge",
"possible_keys": ["MaestroID", "AppID"],
"key_length": "4,4",
"index_merge": {
"intersect": [
{
"range": {
"key": "MaestroID",
"used_key_parts": ["MaestroID"]
}
},
{
"range": {
"key": "AppID",
"used_key_parts": ["AppID"]
}
}
]
},
"r_loops": 1,
"rows": 10103,
"r_rows": 5851,
"r_table_time_ms": 16.3543846,
"r_other_time_ms": 53.27444188,
"r_engine_stats": {
"pages_accessed": 17780
},
"filtered": 100,
"r_filtered": 12.11758674,
"attached_condition": "best_record.MaestroID = @maestro and best_record.AppID = @app and year(best_record.RecordDateTime) = 2026 and month(best_record.RecordDateTime) = 8"
}
}
]
}
}
}
}
=== q6_month_range ===
{
"query_optimization": {
"r_total_time_ms": 0.215072801
},
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": 79.70009072,
"filesort": {
"sort_key": "max(best_record.BestRecord) desc, best_record.PlayerID",
"r_loops": 1,
"r_total_time_ms": 0.072174363,
"r_used_priority_queue": false,
"r_output_rows": 262,
"r_buffer_size": "6Kb",
"r_sort_mode": "sort_key,rowid",
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "best_record",
"access_type": "index_merge",
"possible_keys": ["MaestroID", "AppID"],
"key_length": "4,4",
"index_merge": {
"intersect": [
{
"range": {
"key": "MaestroID",
"used_key_parts": ["MaestroID"]
}
},
{
"range": {
"key": "AppID",
"used_key_parts": ["AppID"]
}
}
]
},
"r_loops": 1,
"rows": 10103,
"r_rows": 5851,
"r_table_time_ms": 19.07379578,
"r_other_time_ms": 54.36322855,
"r_engine_stats": {
"pages_accessed": 17780
},
"filtered": 100,
"r_filtered": 12.11758674,
"attached_condition": "best_record.MaestroID = @maestro and best_record.AppID = @app and best_record.RecordDateTime >= '2026-08-01 00:00:00' and best_record.RecordDateTime < '2026-09-01 00:00:00'"
}
}
]
}
}
}
}