Skip to content

seeun0210/nestjs-sqlite-orm

Repository files navigation

sqlite를 사용하기 위한 sync orm 찾기

  • drizzle orm 사용

benchmark test

✓ should benchmark getStep (206 ms) ✓ should benchmark createStep (동기, await 없음) (15 ms) ✓ should benchmark createStep (await 붙임) (12 ms) ✓ should benchmark createStep (WAL mode) (89 ms) ✓ should benchmark createStep (ROLLBACK mode) (318 ms) ✓ should benchmark bulk insert (827 ms) ✓ should benchmark createStep (sql) (19 ms) ✓ should benchmark createStep (Drizzle ORM) (81 ms) ✓ should benchmark updateStep (sql) (9 ms) ✓ should benchmark updateStep (Drizzle ORM) (60 ms) ✓ should benchmark join (sql) (5 ms) ✓ should benchmark join (Drizzle ORM) (131 ms) ✓ should benchmark transaction insert (sql) (6 ms) ✓ should benchmark transaction insert (Drizzle ORM) (38 ms)

sqlite 라이브러리 비교 및 벤치마크

벤치마크 결과 (ms)

테스트 항목 sql (better-sqlite3) Drizzle ORM (better-sqlite3)
createStep 19 81
updateStep 9 60
join 5 131
transaction insert 6 38
  • sql: better-sqlite3의 prepare/run 등 생쿼리 직접 실행
  • Drizzle ORM: better-sqlite3 기반 Drizzle ORM 사용

sqlite3 vs better-sqlite3 비교

구분 sqlite3 (node-sqlite3) better-sqlite3
API 방식 비동기(콜백/Promise) 동기(Synchronous)
성능 느림(이벤트루프, 콜백 오버헤드) 빠름(싱글스레드, 네이티브)
사용성 콜백/Promise 필요 바로 결과 반환
트랜잭션 지원 있음(비동기) 있음(동기, 매우 빠름)
대량 insert 느림 매우 빠름
에러 처리 콜백/Promise에서 처리 try/catch로 바로 처리
TypeORM 지원 공식 지원 공식 미지원
Drizzle ORM 지원 미지원 공식 지원
설치 용이성 보통 보통
네이티브 빌드 필요 필요(ARM/M1에서 이슈 있을 수 있음)
  • better-sqlite3: Node.js에서 가장 빠른 SQLite 드라이버. 동기식 API, 트랜잭션, 대량 insert에서 강력한 성능.
  • sqlite3: TypeORM, Prisma 등에서 공식 지원. 비동기/Promise 기반으로 이벤트루프에 친화적.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published