운영 서버에서 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:
@@ -0,0 +1,40 @@
|
||||
# 사용법: python3 summarize_explain.py baseline [after]
|
||||
import glob
|
||||
import json
|
||||
import sys
|
||||
|
||||
|
||||
def find_table(node):
|
||||
if isinstance(node, dict):
|
||||
if isinstance(node.get("table"), dict):
|
||||
return node["table"]
|
||||
children = node.values()
|
||||
elif isinstance(node, list):
|
||||
children = node
|
||||
else:
|
||||
return None
|
||||
for child in children:
|
||||
found = find_table(child)
|
||||
if found:
|
||||
return found
|
||||
return None
|
||||
|
||||
|
||||
def keys_of(node):
|
||||
if isinstance(node, dict):
|
||||
for k, v in node.items():
|
||||
if k == "key":
|
||||
yield v
|
||||
else:
|
||||
yield from keys_of(v)
|
||||
elif isinstance(node, list):
|
||||
for v in node:
|
||||
yield from keys_of(v)
|
||||
|
||||
|
||||
for prefix in sys.argv[1:]:
|
||||
for path in sorted(glob.glob(f"{prefix}_explain_*.json")):
|
||||
with open(path, encoding="utf-8") as f:
|
||||
table = find_table(json.load(f))
|
||||
key = table.get("key") or " ∩ ".join(keys_of(table.get("index_merge", {}))) or "-"
|
||||
print(f"{path:40} access_type={str(table.get('access_type')):12} key={key:28} rows={table.get('rows')}")
|
||||
Reference in New Issue
Block a user