let db = new sqlite3.Database(':memory:');
db명을 ":memory:"로 하면 디스크에 저장되지 않고 메모리 위에서 동작한다.
1700여개의 파일을 읽고 DB에 쓰는 작업시 21s -> 1s로 20배 이상 빨라졌다. RAM에 있으니 데이터 유실에 주의할 것.
SQLite In-Memory Databases 레퍼런스 : https://www.sqlite.org/inmemorydb.html
In-Memory Databases
An SQLite database is normally stored in a single ordinary disk file. However, in certain circumstances, the database might be stored in memory. The most common way to force an SQLite database to exist purely in memory is to open the database using the spe
www.sqlite.org
node-sqlite3 API 레퍼런스 : https://github.com/mapbox/node-sqlite3/wiki/API
mapbox/node-sqlite3
Asynchronous, non-blocking SQLite3 bindings for Node.js - mapbox/node-sqlite3
github.com
'프로그래밍 > JS+Node.js' 카테고리의 다른 글
[Node.js] 연습1 : 중복 파일 검색 후 특정 폴더로 이동 (0) | 2019.07.05 |
---|---|
[Node.js] SQLite3 : run() 예외 처리 (0) | 2019.06.12 |
[Node.js] 해시값 계산 : Crypto 모듈 (0) | 2019.06.12 |
[자바스크립트] Ajax 통신 : XMLHttpRequest, Fetch API (0) | 2019.06.10 |