Skip to content

CLI Reference

The particledb binary provides subcommands for starting the server, managing data, running backups, and more.

Terminal window
particledb <COMMAND> [OPTIONS]

The examples on this page use the installed release binary name, particledb. If you are running directly from a local Cargo build in this repo, use target/release/spanner instead.

CommandDescription
startStart the database server
initInitialize a new data directory
dumpExport schema and data as SQL (logical backup)
loadImport a SQL dump into a running server
migrateMigrate data from PostgreSQL to ParticleDB
backupCreate, restore, list, and validate backup archives
snapshotSnapshot lifecycle management (create, list, delete, prune, restore)
benchRun built-in benchmarks
verifyCheck data integrity of a data directory
deployCloud deployment management
versionPrint version information

Start the ParticleDB server.

Terminal window
particledb start [OPTIONS]
FlagDefaultDescription
--pg-addr0.0.0.0:5432PostgreSQL wire protocol listen address
--pg-unix-socketconfig default (/tmp/.s.PGSQL.5433)Unix domain socket path; pass an empty string to disable
--http-addr0.0.0.0:8080HTTP server (dashboard, health, REST API)
--grpc-addr0.0.0.0:26257gRPC listen address
--metrics-port9090Prometheus metrics endpoint port
--health-port8080Health check endpoint port (Kubernetes probes)
--max-connections100Maximum concurrent connections
--connection-timeout300Idle connection timeout in seconds (0 = disabled)
FlagDefaultDescription
-c, --configconfig.tomlPath to configuration file
-d, --data-dir./dataData storage directory
--cold-storage-path(disabled)Cold storage path for tiered storage offloading (local dir, S3 mount, or NFS)
--tier-after-level3LSM level at which SSTables move to cold storage
FlagDefaultDescription
--auth-methodtrustAuthentication method: trust, password, md5
--pg-password(none)Password for PG client authentication
--no-authfalseDisable all authentication (local development only)
--tls-cert(none)TLS certificate file (PEM) for PG wire, Redis, and gRPC
--tls-key(none)TLS private key file (PEM) for PG wire, Redis, and gRPC
--audit-logfalseEnable audit logging (query with SELECT * FROM __pdb_audit_log)
--audit-log-selectsfalseAlso log SELECT queries in the audit log (high volume)
FlagDefaultDescription
--wal-sync-modegroupsyncWAL durability mode: sync, groupsync, nosync
--txn-modeoccTransaction mode: fast, occ, serializable
--oltp-partitions0Number of OLTP partition workers (0 = disabled)
ModeDurable when COMMIT returns?Batching policyUse case
syncYesfsync forced at the commit siteLowest commit latency variance
groupsyncYesConcurrent commits share one fsyncProduction default
nosyncNono fsyncBenchmarks, ephemeral data

sync and groupsync are both durable-on-return; they differ only in when the fsync is issued. Under concurrency groupsync amortizes one fsync across many committers, so most commits perform no disk I/O of their own.

Exactly two modes, one name each:

ModeIsolation levelAllows
fastNoneconcurrent writers overwriting each other
occ (default)Snapshot Isolationpredicate anti-dependency cycles (G2)
serializableStrict Serializablenothing

If --txn-mode is omitted the server runs occ. A durability flag never changes your isolation level.

The one exception: with --wal-sync-mode sync and no --txn-mode, the server refuses to start (exit 1). That combination once implied a serializable engine, so defaulting it to occ would quietly downgrade an existing deployment. State the mode explicitly.

See Transaction Engine for the full anomaly matrix and for per-session SET TRANSACTION ISOLATION LEVEL behavior.

Earlier releases accepted eighteen --txn-mode values for five isolation levels. Every removed spelling now exits non-zero and names its replacement:

RemovedUse insteadNote
occ-v3, occv3, occ-v2, occv2, zero-copy-occ, zcocc, serializable-occoccSame engine — these were already aliases of one mode
strict-serializable, strict-serserializableSame mode, single canonical name
serializable-ssi, ssiserializableStrict serializable is strictly stronger
table-2pl, 2pl, row-2pl, row_2plserializabletable-2pl had already stopped being two-phase locking and delivered serializable isolation instead
fastoccfast provided no isolation guarantee. occ is not a drop-in performance equivalent — it is a real isolation level

The per-session SET txn_mode = '…' GUC still accepts the historical names, so existing sessions keep the level they had. It is therefore broader than --txn-mode and does not match it: it accepts spellings the CLI rejects (occ-v3, serializable-ssi, table-2pl) and rejects serializable, the CLI’s own canonical name. Prefer setting the mode at startup, and use the standard SET TRANSACTION ISOLATION LEVEL spellings per session.

When --oltp-partitions is set to a value greater than 0, data is partitioned across that many dedicated OS threads by primary key hash. Each partition worker owns its data exclusively, eliminating lock contention for single-partition transactions. Set this to the number of CPU cores for TPC-C-style warehouse-affine workloads.

FlagDefaultDescription
--snapshot-enabledfalseEnable automated periodic snapshots
--snapshot-interval3600Snapshot interval in seconds
--snapshot-max10Maximum number of snapshots to retain
--snapshot-retention-days(none)Delete snapshots older than this many days
--snapshot-dir./snapshotsDirectory for storing snapshots
FlagDefaultDescription
--load-datasets(none)Comma-separated list of datasets to preload (e.g., netflix,airline,yandex)
--dataset-scale10000000Number of rows per dataset
Terminal window
# Production startup with groupsync durability and OCC transactions
particledb start \
--data-dir /var/lib/particledb \
--pg-addr 0.0.0.0:5432 \
--http-addr 0.0.0.0:8080 \
--wal-sync-mode groupsync \
--txn-mode occ \
--auth-method password \
--pg-password mysecretpassword \
--tls-cert /etc/particledb/cert.pem \
--tls-key /etc/particledb/key.pem
# Local development with no auth
particledb start --no-auth --data-dir ./mydata
# High-throughput benchmark mode
particledb start \
--wal-sync-mode nosync \
--txn-mode occ \
--oltp-partitions 32
# Preload Netflix dataset at 10M rows
particledb start --load-datasets netflix --dataset-scale 10000000

Initialize a new data directory with the required file structure.

Terminal window
particledb init [OPTIONS]
FlagDefaultDescription
-d, --data-dir./dataData directory to initialize
--shards1Number of initial shards
--replication-factor1Replication factor
Terminal window
particledb init --data-dir /var/lib/particledb --shards 4 --replication-factor 3

Export database schema and data as SQL statements (logical backup). Connects to a running ParticleDB instance via PG wire protocol.

Terminal window
particledb dump [OPTIONS]
FlagDefaultDescription
--pg-addr127.0.0.1:5432Server address to connect to
-o, --output(stdout)Output file path
--tables(all)Comma-separated list of tables to dump
Terminal window
# Dump all tables to a file
particledb dump --output backup.sql
# Dump specific tables
particledb dump --tables users,orders --output partial.sql

Load a SQL dump into a running ParticleDB server.

Terminal window
particledb load [OPTIONS]
FlagDefaultDescription
--pg-addr127.0.0.1:5432Server address to connect to
-i, --input(required)Input SQL file to load
Terminal window
particledb load --input backup.sql

Migrate data directly from a PostgreSQL database to a running ParticleDB server.

Terminal window
particledb migrate [OPTIONS]
FlagDefaultDescription
--source(required)Source PostgreSQL connection URL
--target127.0.0.1:5432Target ParticleDB server address
--tables(all)Comma-separated list of tables to migrate
--batch-size10000Number of rows per batch
Terminal window
# Migrate all tables
particledb migrate --source postgres://user:pass@pghost:5432/mydb
# Migrate specific tables with custom batch size
particledb migrate \
--source postgres://user:pass@pghost:5432/mydb \
--tables users,orders,products \
--batch-size 50000

Manage compressed .tar.gz backup archives.

Terminal window
particledb backup create --output /backups/pdb_backup.tar.gz [--data-dir ./data]
Terminal window
particledb backup restore --input /backups/pdb_backup.tar.gz [--data-dir ./data] [--force]
Terminal window
particledb backup list [--dir /backups] [--format table|json]
Terminal window
particledb backup validate --input /backups/pdb_backup.tar.gz

Snapshot lifecycle management for point-in-time recovery.

Create a point-in-time snapshot. The database must be stopped (or use --force).

Terminal window
particledb snapshot create [--data-dir ./data] [--snapshot-dir ./snapshots] [--cold-storage-path /mnt/cold] [--force]
Terminal window
particledb snapshot list [--snapshot-dir ./snapshots] [--format table|json]
Terminal window
particledb snapshot delete <SNAPSHOT_ID> [--snapshot-dir ./snapshots]

Remove expired snapshots according to retention policy.

Terminal window
particledb snapshot prune [--snapshot-dir ./snapshots] [--max-snapshots 10] [--retention-days 30]

Restore from a snapshot, optionally with point-in-time recovery.

Terminal window
# Restore a specific snapshot
particledb snapshot restore snap_20260309_120000 --target-dir /var/lib/particledb
# Point-in-time recovery
particledb snapshot restore --target-dir /var/lib/particledb --pitr '2026-03-09T14:30:00Z'

Archive WAL segments for PITR capability.

Terminal window
particledb snapshot archive-wal --wal-dir ./data/wal --snapshot-dir ./snapshots
Terminal window
particledb snapshot status [--snapshot-dir ./snapshots]

Check data integrity of a ParticleDB data directory (offline).

Terminal window
particledb verify [--data-dir ./data] [--consistency true]

The --consistency flag enables full data recovery and consistency checks (slower but more thorough).


Run built-in benchmarks.

Generate test data for benchmarks.

Terminal window
particledb bench generate [--users 10000] [--orders 100000] [--events 1000000]
Terminal window
particledb bench run \
[--workload point-reads|range-scans|writes|transactions|mixed|analytical] \
[--duration 30] \
[--concurrency 8] \
[--report table|json|csv] \
[--compare previous_run.json]

Runtime configuration is driven primarily by CLI flags and config.toml. The PDB_* variables below are diagnostic/runtime toggles that exist in the current codebase; there is not a full environment-variable mirror for every CLI flag.

VariableValuesDescription
PDB_WIRE_TRACE1Log every PG wire message (Parse, Bind, Execute, Sync) with timing
PDB_WIRE_DUMP1Dump raw wire bytes for protocol debugging
PDB_REDIS_PROFILE1 or NLog Redis commands with timing (N = sample every Nth command)
PDB_OLTP_PROFILE1 or NLog OLTP operations with timing (N = sample every Nth)
PDB_PARTITION_PROFILE1 or NLog OLTP partition-worker timings (N = reporting interval in seconds)
Terminal window
# Enable wire trace
PDB_WIRE_TRACE=1 particledb start
# Profile every 100th Redis command
PDB_REDIS_PROFILE=100 particledb start

ParticleDB uses the RUST_LOG environment variable for log filtering:

Terminal window
# Default info level
RUST_LOG=info particledb start
# Debug logging for the SQL planner
RUST_LOG=info,spanner_sql::planner=debug particledb start
# Trace-level WAL logging
RUST_LOG=info,spanner_wal=trace particledb start