ClickMasters
← Back to all FAQ cards

Database & Data Management

Database Management Services FAQs

What is connection pooling and why does PostgreSQL need it?

PostgreSQL handles each client connection as a separate operating system process each connection consumes approximately 5-10MB of memory. RDS PostgreSQL instances have a maximum connection limit based on instance size (db.t3.medium: 170 connections; db.r5.large: 1,373 connections). Modern application architectures create many short-lived connections serverless functions, microservices with multiple instances, and ORMs with connection pools all contribute to connection count. Without connection pooling, a modestly-sized application (20 ECS tasks, each with a Prisma connection pool of 10) creates 200 database connections perfectly feasible to exhaust the limit. PgBouncer solves this by multiplexing thousands of application connections over a small number of actual database connections (a PgBouncer pool of 20 connections can serve hundreds of application connections in transaction pooling mode). RDS Proxy is AWS's managed alternative to PgBouncer particularly valuable for Lambda functions where per-invocation connection creation would otherwise overwhelm PostgreSQL.

How should PostgreSQL backups be structured for a production database?

A production PostgreSQL backup strategy requires three layers. Continuous WAL archiving (Write-Ahead Log AWS RDS stores transaction logs continuously, enabling point-in-time recovery to any specific second within the retention window the most valuable recovery capability). Daily automated snapshots (RDS automated backups create a daily snapshot and retain it for the configured retention period 7 days minimum for production, 30-35 days for regulated workloads). Logical backups (pg_dump portable, schema+data export that can be restored to a different PostgreSQL version or a completely different database stored in S3, weekly or monthly schedule, retained for 90+ days). The critical missing step in most backup setups: restore verification. ClickMasters automates a weekly restore procedure restores the latest RDS snapshot to a test instance, validates the schema and row counts confirming that backups are actually restorable before the disaster that requires them.

What is MVCC and why does PostgreSQL need VACUUM?

MVCC (Multi-Version Concurrency Control) is PostgreSQL's mechanism for handling concurrent transactions without locking: instead of overwriting a row when it is updated, PostgreSQL creates a new version of the row alongside the old version. Readers see the version that was current when their transaction started. This enables readers and writers to never block each other. The consequence: deleted and updated rows are not immediately removed the old versions remain as 'dead tuples' until VACUUM reclaims them. Without regular vacuuming, tables accumulate dead tuples: the table grows in size (more disk pages to scan), queries become slower (more I/O to scan pages with many dead tuples), index bloat occurs (index entries for dead tuples remain until VACUUM cleans them), and most critically PostgreSQL's 32-bit transaction ID counter wraps around after approximately 2 billion transactions, causing transaction ID wraparound (a very serious condition that prevents all new writes until resolved). PostgreSQL's autovacuum daemon handles this automatically for most tables, but must be configured appropriately for high-write tables.

What is RDS Multi-AZ and does every B2B product need it?

RDS Multi-AZ (Multi-Availability Zone) maintains a synchronous standby replica of your RDS instance in a different AWS Availability Zone. If the primary instance fails (hardware failure, network issue, Availability Zone outage), RDS automatically promotes the standby to primary the failover takes 60-120 seconds and is transparent to the application (the DNS endpoint stays the same). Multi-AZ provides: high availability (single-AZ failure does not take down the database), zero data loss on failover (synchronous replication every committed transaction is confirmed on the standby before the primary acknowledges), and reduced maintenance downtime (Multi-AZ instances can perform OS patching with a failover rather than a full maintenance window). Every production B2B database should use Multi-AZ the cost is approximately 2x single-AZ (an additional standby instance), which is the appropriate price for database high availability. Dev and staging environments do not need Multi-AZ.