Measure performance
Measure startup, query latency, memory, and installed size for your own application.
Measure Oliphaunt with your schema, selected extensions, and target device.
Separate the costs
| Measurement | Start and end points |
|---|---|
| First open | Before opening a new root → usable database handle |
| Reopen | Before opening existing persistent storage → usable handle |
| First query | Before submitting SQL → decoded result |
| Steady-state query | The same query after initialization, over repeated runs |
| Transaction | Before beginning → committed result |
| Backup | Before requesting backup → complete returned archive |
| App footprint | Installed application and resources, plus database storage |
Include storage initialization and extension activation when those happen during real startup. Measure packaged release builds; development builds and asset caches can change results.
Measure a query
With an open native TypeScript database, record the elapsed time around the complete awaited operation:
const started = performance.now();
const result = await db.query('SELECT 42::int4 AS answer');
const elapsedMs = performance.now() - started;
console.log({ elapsedMs, answer: result.rows[0]?.answer });Repeat measurements and report the median and a tail percentile alongside the sample count. Keep the device, runtime mode, schema, row count, SQL, parameter values, and extension selection constant when comparing runs.
Investigate slow SQL
For an existing notes(id, body) table, use PostgreSQL's query planner with representative data:
EXPLAIN (ANALYZE, BUFFERS)
SELECT id, body FROM notes WHERE id = 42;ANALYZE executes the statement. Use a disposable copy for statements with side effects. Check indexes, row estimates, result size, and time spent decoding before changing runtime settings.
Typed queries buffer results. Select only the columns you need and paginate large application reads. Batch related writes in bounded transactions instead of committing each row separately.
Compare runtime modes
Direct, broker, and server modes have different process and connection costs. Measure the mode you will ship. For async integrations, measure UI responsiveness or executor delay separately from SQL latency.
Browser persistence includes host-provider work. Compare memory and persistent storage only if you report that difference; an in-memory result does not predict durable write latency.
When comparing with SQLite, include installed size and memory as well as query speed. See Moving from SQLite for the integration differences.