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]
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-socket(disabled)Unix domain socket path (e.g., /tmp/.s.PGSQL.5432)
--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-mode(inferred)Transaction isolation mode: fast, occ, row-2pl, table-2pl
--oltp-partitions0Number of OLTP partition workers (0 = disabled)
ModeDurabilityPerformanceUse Case
syncFull (per-transaction fsync)BaselineMission-critical data
groupsync~14ms batch window3-6x fasterProduction default
nosyncNoneMaximum throughputBenchmarks, ephemeral data
ModeBehaviorJepsen-Safe
fastNo locks, maximum OLTP throughputNo
occOptimistic concurrency control with buffered writes and commit-time validationYes
row-2plAlias for occYes
table-2plExclusive table locks, lowest concurrencyYes

If --txn-mode is omitted, ParticleDB infers it from the WAL mode: nosync/groupsync defaults to fast, sync defaults to occ.

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 fast \
--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]

Every configuration option can be set via an environment variable with the PDB_ prefix:

Terminal window
PDB_PG_ADDR=0.0.0.0:5432
PDB_WAL_SYNC_MODE=groupsync
PDB_AUTH_METHOD=password
PDB_TLS_CERT=/path/to/cert.pem
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_AGG_TELEMETRY1Log which aggregation strategy was chosen per query
Terminal window
# Enable wire trace and aggregate telemetry
PDB_WIRE_TRACE=1 PDB_AGG_TELEMETRY=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