핵심 요약
한국그린데이터가 MongoDB 5.0에서 Time Series Collections를 도입하고, 생성 방법·쓰기·읽기 및 성능 이점을 다루는 블로그를 소개합니다.
구현 방법
- timeField, metaField, granularity를 미리 지정해 메타데이터를 인접 블록에 저장하고 인덱스 크기를 줄이는 원리
- 컬렉션 생성 예시: db.createCollection("weather", { timeseries: { timeField: "timestamp", metaField: "source", granularity: "seconds" }})
- 구조: Metadata, Measurements, Internal로 분리 저장
- 쓰기/읽기: insertMany with ordered:false로 대량 쓰기, 간단한 aggregate로 읽기
주요 결과
- 저장 용량: 약 1/4 크기 (5,357,568 bytes vs 21,934,080 bytes)
- 읽기 속도: 단순 쿼리 2 ms vs 200 ms; 복합 쿼리 615 ms vs 1,022 ms



