100+ PostgreSQL DBA Interview Questions and Answers [2025 Guide]
![100+ PostgreSQL DBA Interview Questions and Answers [2025 Guide]](https://thedbadmin-lms.b-cdn.net/assets/blog-images/featureImage/100-postgresql-dba-interview-questions-a4f69ddb32681cdc.webp)
Comprehensive PostgreSQL Database Administrator (DBA) interview preparation guide with 100+ real-world questions and detailed answers. Covers database backup, recovery, replication, performance tuning, security, monitoring, and cloud platforms (AWS RDS, Azure).
This comprehensive guide presents 100+ essential PostgreSQL Database Administrator (DBA) interview questions and answers, organized by topic. Whether you're preparing for a junior or senior PostgreSQL DBA interview, studying for PostgreSQL certification, or looking to assess your database administration expertise, these questions cover all key aspects of PostgreSQL administration and management.
Want to master PostgreSQL?
Check out our comprehensive PostgreSQL DBA Course! This course covers everything from basic administration to advanced topics, helping you become a proficient PostgreSQL Database Administrator. Perfect for both beginners and experienced DBAs looking to enhance their skills.
Basic Concepts (1-10)
What is PostgreSQL?
- Open-source RDBMS emphasizing extensibility and SQL compliance
- Object-relational database supporting both relational and non-relational features
What are the key features of PostgreSQL?
- ACID compliance
- Multi-Version Concurrency Control (MVCC)
- Table inheritance
- Custom functions
- Table partitioning
- Rich indexing options
What is MVCC in PostgreSQL?
- Mechanism allowing multiple transactions to access the same data simultaneously
- Each transaction sees a snapshot of data from a particular point in time
What are roles in PostgreSQL?
- Database objects managing database access permissions
- Can be users or groups
- Support inheritance of permissions
What is WAL in PostgreSQL?
- Write-Ahead Logging
- Ensures data integrity by logging changes before they're written to data files
What is the postgresql.conf file?
- Main configuration file containing database parameters
- Controls memory, connections, replication, etc.
What is the pg_hba.conf file?
- Host-Based Authentication configuration file
- Controls client authentication methods and access
What are tablespaces in PostgreSQL?
- Physical locations where databases store their data
- Allow distributing database objects across different storage devices
What is the difference between TRUNCATE and DELETE?
- TRUNCATE is faster, removes all rows at once
- DELETE removes rows one by one, can use WHERE clause
What is autovacuum in PostgreSQL?
- Automated process that removes dead tuples and updates statistics
- Essential for maintaining database performance
Backup & Recovery (11-20)
What is pg_dump?
- Logical backup tool for single database
- Creates SQL script or archive file format
What is pg_basebackup?
- Physical backup tool for entire cluster
- Creates exact copy of database files
What is Point-in-Time Recovery (PITR)?
- Ability to restore database to specific point in time
- Uses WAL archives and base backup
What is continuous archiving?
- Method of archiving WAL files continuously
- Essential for PITR capability
How do you take a hot backup?
- Use pg_basebackup while database is running
- Ensure archive_mode is enabled
What is recovery.conf?
- In PostgreSQL <12: Recovery configuration file
- In PostgreSQL ≥12: Uses recovery.signal and standby.signal
What is archive_command?
- Configuration parameter specifying WAL archiving method
- Example: 'cp %p /archive/%f'
What is restore_command?
- Specifies how to retrieve archived WAL files during recovery
- Example: 'cp /archive/%f %p'
What is recovery_target_time?
- Parameter specifying point-in-time for recovery
- Format: 'YYYY-MM-DD HH:MM:SS'
What is pg_dumpall?
- Backs up entire PostgreSQL cluster
- Includes roles and tablespace definitions
Performance Tuning (21-30)
What is EXPLAIN ANALYZE?
- Shows query execution plan with actual timings
- Helps identify performance bottlenecks
What are statistics in PostgreSQL?
- Data about tables and columns
- Used by query planner to create efficient plans
What is shared_buffers?
- Memory parameter for shared data cache
- Typically 25% of total RAM
What is work_mem?
- Memory for sort operations and hash tables
- Set per operation, not total
What is effective_cache_size?
- Estimate of disk cache available
- Influences query planner decisions
What is vacuum?
- Reclaims storage from dead tuples
- Updates statistics for query planner
What is analyze?
- Updates statistics about table contents
- Improves query planner estimates
What are index types in PostgreSQL?
- B-tree (default)
- Hash
- GiST
- SP-GiST
- GIN
- BRIN
What is table partitioning?
- Splitting large tables into smaller pieces
- Improves query performance and manageability
What is parallel query?
- Multiple workers executing parts of query
- Controlled by max_parallel_workers parameter
High Availability (31-40)
What is streaming replication?
- Real-time WAL shipping to standby servers
- Provides high availability
What is synchronous replication?
- Ensures transaction commit waits for standby
- Provides stronger consistency guarantees
What is Patroni?
- HA solution for PostgreSQL
- Manages failover and replication
What is pg_rewind?
- Tool to re-synchronize primary and standby
- Used after failback scenarios
What is replication slot?
- Prevents removal of needed WAL files
- Ensures standby doesn't fall behind
What is hot_standby?
- Allows queries on standby server
- May impact replication performance
What is promote_trigger_file?
- File triggering standby promotion
- Used in manual failover
What is primary_conninfo?
- Connection string to primary server
- Used by standby for replication
What is application_name in replication?
- Identifies standby servers
- Used in monitoring and configuration
What is pg_stat_replication?
- View showing replication status
- Shows lag and connection details
Security (41-50)
What is SSL in PostgreSQL?
- Encrypts client/server communications
- Configured in postgresql.conf
What is Row-Level Security (RLS)?
- Fine-grained access control at row level
- Implemented using policies
What are GRANT/REVOKE?
- Commands managing permissions
- Control access to database objects
What is password encryption?
- Passwords stored using SCRAM-SHA-256
- Previous methods: MD5, password
What is client authentication?
- Methods: trust, password, md5, cert
- Configured in pg_hba.conf
What is pgcrypto?
- Extension for cryptographic functions
- Supports various encryption methods
What are connection limits?
- max_connections parameter
- Per-role connection limits
What is pg_audit?
- Extension for detailed audit logging
- Tracks database activities
What is SSL certificate authentication?
- Client authentication using certificates
- Requires SSL configuration
What are default privileges?
- ALTER DEFAULT PRIVILEGES command
- Sets permissions for new objects
Monitoring (51-60)
What is pg_stat_activity?
- View showing server process activities
- Shows current queries and states
What is pg_stat_statements?
- Extension tracking query execution statistics
- Shows query performance metrics
What are wait events?
- Show what processes are waiting for
- Help identify bottlenecks
What is log_min_duration_statement?
- Logs queries exceeding specified duration
- Helps identify slow queries
What is pg_stat_bgwriter?
- Shows background writer statistics
- Helps tune checkpoints
What is pg_stat_database?
- Database-wide statistics
- Shows transactions, tuples, cache hits
What is track_io_timing?
- Enables I/O timing measurements
- Shows detailed I/O statistics
What is log_checkpoints?
- Logs checkpoint activity
- Helps monitor I/O activity
What is pg_stat_user_tables?
- Table access and update statistics
- Shows vacuum and analyze activity
What is pg_locks?
- Shows current locks
- Helps diagnose blocking issues
Cloud & AWS RDS (61-70)
What is RDS for PostgreSQL?
- AWS managed PostgreSQL service
- Handles maintenance and backups
What are parameter groups in RDS?
- Manage database configuration
- Some parameters can't be modified
What is Multi-AZ in RDS?
- Automatic failover capability
- Synchronous replication to standby
What is RDS read replica?
- Asynchronous replication copy
- Offloads read operations
What is Aurora PostgreSQL?
- AWS-optimized PostgreSQL variant
- Claims better performance
What is RDS automated backup?
- Daily backups and transaction logs
- Enables point-in-time recovery
What is RDS encryption?
- At-rest encryption using KMS
- SSL for in-transit encryption
What is RDS monitoring?
- Enhanced monitoring metrics
- Performance Insights
What is RDS proxy?
- Connection pooling service
- Reduces connection management overhead
What is RDS event notification?
- SNS notifications for RDS events
- Monitors database changes
Azure PostgreSQL (71-80)
What is Azure Database for PostgreSQL?
- Microsoft's managed PostgreSQL service
- Offers single server and flexible server
What is Flexible Server?
- Newer deployment option
- More control over configuration
What is Azure high availability?
- Zone-redundant HA
- Automatic failover
What is Azure backup?
- Automated backups
- Geo-redundant storage option
What is Azure networking?
- Private Link
- VNET integration
What is Azure monitoring?
- Azure Monitor integration
- Query Performance Insight
What is Azure scaling?
- Vertical and horizontal scaling
- Storage autogrowth
What is Azure maintenance?
- Planned maintenance windows
- Automatic minor version updates
What is Azure firewall?
- Server-level firewall rules
- VNET service endpoints
What is Azure PostgreSQL pricing?
- Compute + Storage pricing model
- Reserved capacity options
Advanced Features (81-90)
What is pgvector?
- Vector similarity search extension
- Used for AI/ML applications
What is pg_cron?
- Job scheduling extension
- Runs periodic SQL commands
What is pg_stat_monitor?
- Advanced monitoring extension
- Provides detailed query statistics
What is logical replication?
- Replication at object level
- Supports selective replication
What is pg_partman?
- Partition management extension
- Automates partition creation
What is pg_bouncer?
- Connection pooler
- Reduces connection overhead
What is Foreign Data Wrapper?
- Connects to external data sources
- Supports various data formats
What is pg_upgrade?
- Upgrades PostgreSQL version
- Supports fast and link modes
What is event trigger?
- Triggers on database events
- DDL operation notifications
What is table sampling?
- TABLESAMPLE clause
- Quick data sampling methods
Troubleshooting (91-100)
How to handle connection issues?
- Check pg_hba.conf
- Verify network connectivity
- Check max_connections
How to identify slow queries?
- Use pg_stat_statements
- Check log_min_duration_statement
- EXPLAIN ANALYZE
How to handle disk full?
- VACUUM FULL
- Remove unused indexes
- Archive old data
How to fix high CPU usage?
- Check for missing indexes
- Optimize queries
- Adjust work_mem
How to handle replication lag?
- Monitor pg_stat_replication
- Check network bandwidth
- Adjust wal_keep_segments
How to fix database bloat?
- Regular VACUUM
- Adjust autovacuum settings
- Monitor table/index bloat
How to handle connection pooling?
- Use pg_bouncer
- Adjust pool_size
- Monitor pool statistics
How to fix lock contention?
- Monitor pg_locks
- Optimize transaction duration
- Adjust lock timeout
How to handle index corruption?
- REINDEX command
- Check system logs
- Verify disk health
How to improve checkpoint performance?
- Adjust checkpoint_timeout
- Set checkpoint_completion_target
- Monitor checkpoint timing
Written by
TheDBAdmin Team
KEEP LEARNING WITH THEDBADMIN
Turn this guide into a skill you can prove
Keep reading
Related articles
NextGen DBA + AI Engineer Bootcamp
Instructor-led, lab-first training for production DBAs: PostgreSQL, MongoDB, Docker, Kubernetes and AI.
- Live labs on real execution plans
- Backup, PITR & HA in production
- pgvector, RAG & AI for DBAs
🛒 FROM THE SHOP
PostgreSQL Architecture
PDF · 23 pages
Free