Skip to content

Commit 54e6cba

Browse files
authored
Please consider setting pragma WAL in your introductory documentation (WiseLibs#831)
The performance difference can be several orders of magnitude on even simple tables, and most users won't think to go looking for this. I've included lines that clarify, and link to your existing documentation on the topic. Thank you for an excellent tool.
1 parent d66747e commit 54e6cba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,18 @@ const row = db.prepare('SELECT * FROM users WHERE id = ?').get(userId);
4343
console.log(row.firstName, row.lastName, row.email);
4444
```
4545

46+
Though not required, [it is generally important to set the WAL pragma for performance reasons](https://github.com/WiseLibs/better-sqlite3/blob/master/docs/performance.md).
47+
48+
```js
49+
db.pragma('journal_mode = WAL');
50+
```
51+
4652
##### In ES6 module notation:
4753

4854
```js
4955
import Database from 'better-sqlite3';
5056
const db = new Database('foobar.db', options);
57+
db.pragma('journal_mode = WAL');
5158
```
5259

5360
## Why should I use this instead of [node-sqlite3](https://github.com/mapbox/node-sqlite3)?

0 commit comments

Comments
 (0)