Skip to content

Commit

Permalink
Please consider setting pragma WAL in your introductory documentation (
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
StoneCypher authored Nov 21, 2022
1 parent d66747e commit 54e6cba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,18 @@ const row = db.prepare('SELECT * FROM users WHERE id = ?').get(userId);
console.log(row.firstName, row.lastName, row.email);
```

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).

```js
db.pragma('journal_mode = WAL');
```

##### In ES6 module notation:

```js
import Database from 'better-sqlite3';
const db = new Database('foobar.db', options);
db.pragma('journal_mode = WAL');
```

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

0 comments on commit 54e6cba

Please sign in to comment.