DOCS/journey/troubleshooting/251002_db_separation_emotion_data.md
Claude-51124 22557e7132 docs: 오래된 트러블슈팅 아카이브 및 구조 정리
- 7-8월 초기 구축 문서 12개를 _archive/troubleshooting/2025_07-08_initial_setup/로 이동
- book/300_architecture/390_human_in_the_loop_intent_learning.md를 journey/research/intent_classification/로 이동 (개발 여정 문서)
- 빈 폴더 제거 (journey/assets/*)
2025-11-17 14:06:05 +09:00

44 lines
1.3 KiB
Markdown

# DB 분리 구조 및 감정 데이터 저장 현황
## 발생 일시
2025-10-02
## 현황
세 개의 분리된 데이터베이스 운영 중
### DB 구조
1. **main_db**: 핵심 데이터
- user, conversation_log, gmail_token 등 16개 테이블
- PostgreSQL 일반 DB
2. **robeing_metrics**: 시계열 메트릭
- emotion_readings 테이블 (TimescaleDB 하이퍼테이블)
- 감정 데이터 3건 저장 (2025-10-02 12:21~12:27)
3. **rb8001_db**: rb8001 전용 DB
### 감정 데이터 저장 확인
```sql
-- robeing_metrics DB에 저장
SELECT * FROM emotion_readings;
-- 결과: 3건 (happiness 2건, anger 1건)
```
### 문제점
- conversation_log가 main_db에 있어 시계열 분석 비효율
- 감정 시스템 구현했지만 실제 대화 flow 미연동
- DB 간 JOIN 필요 시 성능 이슈
### 해결 방안
1. conversation_log를 robeing_metrics로 이전
2. user 테이블 주요 컬럼만 robeing_metrics에 읽기 전용 복제
3. Foreign Data Wrapper로 필요시 크로스 DB 조회
### 관련 파일
- `/home/admin/rb8001/app/state/database.py`: METRICS_DB_URL 환경변수
- `/home/admin/rb8001/app/router/emotion_endpoint.py`: robeing_metrics 연결
## 교훈
- 용도별 DB 분리는 유지 (성능/백업 전략 차별화)
- 시계열 데이터는 TimescaleDB 사용
- 자주 조인하는 데이터는 복제 고려