Back to Blog

100+ PostgreSQL DBA Interview Questions and Answers [2025 Guide]

TheDBAdmin Team9 min read
100+ PostgreSQL DBA Interview Questions and Answers [2025 Guide]

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)

  1. What is PostgreSQL?

    • Open-source RDBMS emphasizing extensibility and SQL compliance
    • Object-relational database supporting both relational and non-relational features
  2. What are the key features of PostgreSQL?

    • ACID compliance
    • Multi-Version Concurrency Control (MVCC)
    • Table inheritance
    • Custom functions
    • Table partitioning
    • Rich indexing options
  3. 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
  4. What are roles in PostgreSQL?

    • Database objects managing database access permissions
    • Can be users or groups
    • Support inheritance of permissions
  5. What is WAL in PostgreSQL?

    • Write-Ahead Logging
    • Ensures data integrity by logging changes before they're written to data files
  6. What is the postgresql.conf file?

    • Main configuration file containing database parameters
    • Controls memory, connections, replication, etc.
  7. What is the pg_hba.conf file?

    • Host-Based Authentication configuration file
    • Controls client authentication methods and access
  8. What are tablespaces in PostgreSQL?

    • Physical locations where databases store their data
    • Allow distributing database objects across different storage devices
  9. 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
  10. What is autovacuum in PostgreSQL?

    • Automated process that removes dead tuples and updates statistics
    • Essential for maintaining database performance

Backup & Recovery (11-20)

  1. What is pg_dump?

    • Logical backup tool for single database
    • Creates SQL script or archive file format
  2. What is pg_basebackup?

    • Physical backup tool for entire cluster
    • Creates exact copy of database files
  3. What is Point-in-Time Recovery (PITR)?

    • Ability to restore database to specific point in time
    • Uses WAL archives and base backup
  4. What is continuous archiving?

    • Method of archiving WAL files continuously
    • Essential for PITR capability
  5. How do you take a hot backup?

    • Use pg_basebackup while database is running
    • Ensure archive_mode is enabled
  6. What is recovery.conf?

    • In PostgreSQL <12: Recovery configuration file
    • In PostgreSQL ≥12: Uses recovery.signal and standby.signal
  7. What is archive_command?

    • Configuration parameter specifying WAL archiving method
    • Example: 'cp %p /archive/%f'
  8. What is restore_command?

    • Specifies how to retrieve archived WAL files during recovery
    • Example: 'cp /archive/%f %p'
  9. What is recovery_target_time?

    • Parameter specifying point-in-time for recovery
    • Format: 'YYYY-MM-DD HH:MM:SS'
  10. What is pg_dumpall?

    • Backs up entire PostgreSQL cluster
    • Includes roles and tablespace definitions

Performance Tuning (21-30)

  1. What is EXPLAIN ANALYZE?

    • Shows query execution plan with actual timings
    • Helps identify performance bottlenecks
  2. What are statistics in PostgreSQL?

    • Data about tables and columns
    • Used by query planner to create efficient plans
  3. What is shared_buffers?

    • Memory parameter for shared data cache
    • Typically 25% of total RAM
  4. What is work_mem?

    • Memory for sort operations and hash tables
    • Set per operation, not total
  5. What is effective_cache_size?

    • Estimate of disk cache available
    • Influences query planner decisions
  6. What is vacuum?

    • Reclaims storage from dead tuples
    • Updates statistics for query planner
  7. What is analyze?

    • Updates statistics about table contents
    • Improves query planner estimates
  8. What are index types in PostgreSQL?

    • B-tree (default)
    • Hash
    • GiST
    • SP-GiST
    • GIN
    • BRIN
  9. What is table partitioning?

    • Splitting large tables into smaller pieces
    • Improves query performance and manageability
  10. What is parallel query?

    • Multiple workers executing parts of query
    • Controlled by max_parallel_workers parameter

High Availability (31-40)

  1. What is streaming replication?

    • Real-time WAL shipping to standby servers
    • Provides high availability
  2. What is synchronous replication?

    • Ensures transaction commit waits for standby
    • Provides stronger consistency guarantees
  3. What is Patroni?

    • HA solution for PostgreSQL
    • Manages failover and replication
  4. What is pg_rewind?

    • Tool to re-synchronize primary and standby
    • Used after failback scenarios
  5. What is replication slot?

    • Prevents removal of needed WAL files
    • Ensures standby doesn't fall behind
  6. What is hot_standby?

    • Allows queries on standby server
    • May impact replication performance
  7. What is promote_trigger_file?

    • File triggering standby promotion
    • Used in manual failover
  8. What is primary_conninfo?

    • Connection string to primary server
    • Used by standby for replication
  9. What is application_name in replication?

    • Identifies standby servers
    • Used in monitoring and configuration
  10. What is pg_stat_replication?

    • View showing replication status
    • Shows lag and connection details

Security (41-50)

  1. What is SSL in PostgreSQL?

    • Encrypts client/server communications
    • Configured in postgresql.conf
  2. What is Row-Level Security (RLS)?

    • Fine-grained access control at row level
    • Implemented using policies
  3. What are GRANT/REVOKE?

    • Commands managing permissions
    • Control access to database objects
  4. What is password encryption?

    • Passwords stored using SCRAM-SHA-256
    • Previous methods: MD5, password
  5. What is client authentication?

    • Methods: trust, password, md5, cert
    • Configured in pg_hba.conf
  6. What is pgcrypto?

    • Extension for cryptographic functions
    • Supports various encryption methods
  7. What are connection limits?

    • max_connections parameter
    • Per-role connection limits
  8. What is pg_audit?

    • Extension for detailed audit logging
    • Tracks database activities
  9. What is SSL certificate authentication?

    • Client authentication using certificates
    • Requires SSL configuration
  10. What are default privileges?

    • ALTER DEFAULT PRIVILEGES command
    • Sets permissions for new objects

Monitoring (51-60)

  1. What is pg_stat_activity?

    • View showing server process activities
    • Shows current queries and states
  2. What is pg_stat_statements?

    • Extension tracking query execution statistics
    • Shows query performance metrics
  3. What are wait events?

    • Show what processes are waiting for
    • Help identify bottlenecks
  4. What is log_min_duration_statement?

    • Logs queries exceeding specified duration
    • Helps identify slow queries
  5. What is pg_stat_bgwriter?

    • Shows background writer statistics
    • Helps tune checkpoints
  6. What is pg_stat_database?

    • Database-wide statistics
    • Shows transactions, tuples, cache hits
  7. What is track_io_timing?

    • Enables I/O timing measurements
    • Shows detailed I/O statistics
  8. What is log_checkpoints?

    • Logs checkpoint activity
    • Helps monitor I/O activity
  9. What is pg_stat_user_tables?

    • Table access and update statistics
    • Shows vacuum and analyze activity
  10. What is pg_locks?

    • Shows current locks
    • Helps diagnose blocking issues

Cloud & AWS RDS (61-70)

  1. What is RDS for PostgreSQL?

    • AWS managed PostgreSQL service
    • Handles maintenance and backups
  2. What are parameter groups in RDS?

    • Manage database configuration
    • Some parameters can't be modified
  3. What is Multi-AZ in RDS?

    • Automatic failover capability
    • Synchronous replication to standby
  4. What is RDS read replica?

    • Asynchronous replication copy
    • Offloads read operations
  5. What is Aurora PostgreSQL?

    • AWS-optimized PostgreSQL variant
    • Claims better performance
  6. What is RDS automated backup?

    • Daily backups and transaction logs
    • Enables point-in-time recovery
  7. What is RDS encryption?

    • At-rest encryption using KMS
    • SSL for in-transit encryption
  8. What is RDS monitoring?

    • Enhanced monitoring metrics
    • Performance Insights
  9. What is RDS proxy?

    • Connection pooling service
    • Reduces connection management overhead
  10. What is RDS event notification?

    • SNS notifications for RDS events
    • Monitors database changes

Azure PostgreSQL (71-80)

  1. What is Azure Database for PostgreSQL?

    • Microsoft's managed PostgreSQL service
    • Offers single server and flexible server
  2. What is Flexible Server?

    • Newer deployment option
    • More control over configuration
  3. What is Azure high availability?

    • Zone-redundant HA
    • Automatic failover
  4. What is Azure backup?

    • Automated backups
    • Geo-redundant storage option
  5. What is Azure networking?

    • Private Link
    • VNET integration
  6. What is Azure monitoring?

    • Azure Monitor integration
    • Query Performance Insight
  7. What is Azure scaling?

    • Vertical and horizontal scaling
    • Storage autogrowth
  8. What is Azure maintenance?

    • Planned maintenance windows
    • Automatic minor version updates
  9. What is Azure firewall?

    • Server-level firewall rules
    • VNET service endpoints
  10. What is Azure PostgreSQL pricing?

    • Compute + Storage pricing model
    • Reserved capacity options

Advanced Features (81-90)

  1. What is pgvector?

    • Vector similarity search extension
    • Used for AI/ML applications
  2. What is pg_cron?

    • Job scheduling extension
    • Runs periodic SQL commands
  3. What is pg_stat_monitor?

    • Advanced monitoring extension
    • Provides detailed query statistics
  4. What is logical replication?

    • Replication at object level
    • Supports selective replication
  5. What is pg_partman?

    • Partition management extension
    • Automates partition creation
  6. What is pg_bouncer?

    • Connection pooler
    • Reduces connection overhead
  7. What is Foreign Data Wrapper?

    • Connects to external data sources
    • Supports various data formats
  8. What is pg_upgrade?

    • Upgrades PostgreSQL version
    • Supports fast and link modes
  9. What is event trigger?

    • Triggers on database events
    • DDL operation notifications
  10. What is table sampling?

    • TABLESAMPLE clause
    • Quick data sampling methods

Troubleshooting (91-100)

  1. How to handle connection issues?

    • Check pg_hba.conf
    • Verify network connectivity
    • Check max_connections
  2. How to identify slow queries?

    • Use pg_stat_statements
    • Check log_min_duration_statement
    • EXPLAIN ANALYZE
  3. How to handle disk full?

    • VACUUM FULL
    • Remove unused indexes
    • Archive old data
  4. How to fix high CPU usage?

    • Check for missing indexes
    • Optimize queries
    • Adjust work_mem
  5. How to handle replication lag?

    • Monitor pg_stat_replication
    • Check network bandwidth
    • Adjust wal_keep_segments
  6. How to fix database bloat?

    • Regular VACUUM
    • Adjust autovacuum settings
    • Monitor table/index bloat
  7. How to handle connection pooling?

    • Use pg_bouncer
    • Adjust pool_size
    • Monitor pool statistics
  8. How to fix lock contention?

    • Monitor pg_locks
    • Optimize transaction duration
    • Adjust lock timeout
  9. How to handle index corruption?

    • REINDEX command
    • Check system logs
    • Verify disk health
  10. 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

Featured course · New batch

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

View product