You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONFIGURATION.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,16 +94,16 @@ The schema ships with a small, query-driven set of indexes. The most important o
94
94
Run the read-only benchmark against your own database to confirm the planner is using the expected indexes and to record baseline latencies:
95
95
96
96
```sh
97
-
npm run db:benchmark
98
-
npm run db:benchmark -- --runs 5 --kind 1 --limit 500
97
+
pnpm run db:benchmark
98
+
pnpm run db:benchmark --runs 5 --kind 1 --limit 500
99
99
```
100
100
101
101
The `db:benchmark` script loads the local `.env` file automatically (via `node --env-file-if-exists=.env`), using the same `DB_HOST`/`DB_PORT`/`DB_USER`/`DB_PASSWORD`/`DB_NAME` variables as the relay. The benchmark issues only `EXPLAIN (ANALYZE, BUFFERS)` and `SELECT` statements — it never writes. Flags: `--runs <n>` (default 3), `--kind <n>` (default 1 / `TEXT_NOTE`; pass `0` for SET_METADATA), `--limit <n>` (default 500), `--horizon-days <n>` (default 7), `--help`.
102
102
103
103
For a full before/after proof of the index impact (seeds a throwaway dataset, drops and recreates the indexes, and prints a BEFORE/AFTER table), use:
104
104
105
105
```sh
106
-
npm run db:verify-index-impact
106
+
pnpm run db:verify-index-impact
107
107
```
108
108
109
109
The hot-path index migration (`20260420_120000_add_hot_path_indexes.js`) uses `CREATE INDEX CONCURRENTLY`, so it can be applied to a running relay without taking `ACCESS EXCLUSIVE` locks on the `events` or `invoices` tables.
npm run test:load -- --zombies 5000 --spam-rate 100
613
+
pnpm run test:load --zombies 5000 --spam-rate 100
614
614
```
615
615
616
616
### Analyzing Memory (Heap Snapshots)
@@ -657,10 +657,10 @@ Optional compression is supported for lower storage and transfer costs:
657
657
- XZ via `lzma-native`
658
658
659
659
```
660
-
npm run export # writes to events.jsonl
661
-
npm run export -- backup-2024-01-01.jsonl # custom filename
662
-
npm run export -- backup.jsonl.gz --compress --format=gzip
663
-
npm run export -- backup.jsonl.xz --compress --format=xz
660
+
pnpm run export # writes to events.jsonl
661
+
pnpm run export backup-2024-01-01.jsonl # custom filename
662
+
pnpm run export backup.jsonl.gz --compress --format=gzip
663
+
pnpm run export backup.jsonl.xz --compress --format=xz
664
664
```
665
665
666
666
Flags:
@@ -690,16 +690,16 @@ The script reads the same `DB_*` environment variables used by the relay (see [C
690
690
Run the read-only query benchmark to record the planner's choices and timings for the relay's hot-path queries (REQ subscriptions, vanish checks, purge scans, pending-invoice polls):
691
691
692
692
```
693
-
npm run db:benchmark
694
-
npm run db:benchmark -- --runs 5 --kind 1 --limit 500
693
+
pnpm run db:benchmark
694
+
pnpm run db:benchmark --runs 5 --kind 1 --limit 500
695
695
```
696
696
697
697
The benchmark only issues `EXPLAIN (ANALYZE, BUFFERS)` and `SELECT` statements against your configured database — it never writes. It loads `DB_*` variables from `.env` automatically (via `node --env-file-if-exists=.env`), so no extra setup is required beyond the one you already need to run the relay. Use it to confirm the `events_active_pubkey_kind_created_at_idx`, `events_deleted_at_partial_idx`, and `invoices_pending_created_at_idx` indexes are being picked up.
698
698
699
699
For a reproducible before/after proof on a throwaway dataset, run:
700
700
701
701
```
702
-
npm run db:verify-index-impact
702
+
pnpm run db:verify-index-impact
703
703
```
704
704
705
705
It seeds ~200k synthetic events, drops the hot-path indexes, runs EXPLAIN (ANALYZE, BUFFERS) for each hot query, recreates the indexes, and prints a BEFORE/AFTER table. See the *Database indexes and benchmarking* section of [CONFIGURATION.md](CONFIGURATION.md).
@@ -712,31 +712,31 @@ corresponding data from the derived `event_tags` table when present.
712
712
Dry run (no deletion):
713
713
714
714
```
715
-
npm run clean-db -- --all --dry-run
715
+
pnpm run clean-db --all --dry-run
716
716
```
717
717
718
718
Full wipe:
719
719
720
720
```
721
-
npm run clean-db -- --all --force
721
+
pnpm run clean-db --all --force
722
722
```
723
723
724
724
Delete events older than N days:
725
725
726
726
```
727
-
npm run clean-db -- --older-than=30 --force
727
+
pnpm run clean-db --older-than=30 --force
728
728
```
729
729
730
730
Delete only selected kinds:
731
731
732
732
```
733
-
npm run clean-db -- --kinds=1,7,4 --force
733
+
pnpm run clean-db --kinds=1,7,4 --force
734
734
```
735
735
736
736
Delete only selected kinds older than N days:
737
737
738
738
```
739
-
npm run clean-db -- --older-than=30 --kinds=1,7,4 --force
739
+
pnpm run clean-db --older-than=30 --kinds=1,7,4 --force
740
740
```
741
741
742
742
By default, the script asks for explicit confirmation (`Type 'DELETE' to confirm`).
0 commit comments