PostgreSQL is Authensor's database of choice for audit trails and agent logging. Its combination of ACID compliance, JSONB support, partitioning, and mature tooling makes it well-suited for safety-critical logging workloads where data integrity matters more than write throughput.
ACID transactions guarantee that audit receipts are written completely or not at all. A partial receipt write that corrupts a hash chain is not possible with proper transaction handling.
JSONB columns store flexible event payloads without schema migrations. Agent actions vary widely in structure. JSONB lets you store the full action context while keeping the core receipt fields in typed columns for efficient querying.
Table partitioning enables time-based data management. Authensor uses declarative partitioning to create monthly receipt partitions automatically.
Full-text search lets you search through action descriptions and payloads without an external search engine for small to medium deployments.
Set wal_level = replica to enable point-in-time recovery. For audit data, the ability to recover to any point in time is essential.
Increase checkpoint_timeout and max_wal_size for write-heavy logging workloads. The default values optimize for mixed read/write patterns, but audit logging is append-heavy.
Use synchronous_commit = on for the audit receipt connection. Safety-critical records must be durable before the transaction reports success. For non-critical telemetry data, synchronous_commit = off improves throughput.
Authensor's control plane uses the pg driver with a connection pool. For production deployments, put PgBouncer in front of PostgreSQL. Configure it in transaction mode with a pool size that matches your PostgreSQL max_connections minus a reserve for maintenance.
Use pg_basebackup for full backups and continuous WAL archiving for point-in-time recovery. Store backups in a separate region from your primary database.
Test your restoration process quarterly. An untested backup is not a backup.
Track connection count, transaction rate, replication lag (if using replicas), table bloat, and query latency. Alert on replication lag exceeding 10 seconds and on connection pool saturation. Authensor's health endpoint reports database connectivity status for integration with your monitoring stack.
Explore more guides on AI agent safety, prompt injection, and building secure systems.
View All Guides