How To Be a Postgres DBA in a Pinch with Elizabeth Christensen - DjangoCon US 2022

Master the skills to become a Postgres DBA on the fly, covering installation, monitoring, backups, troubleshooting, maintenance, and security to ensure a smooth-running database experience.

Key takeaways

Run Postgres almost anywhere

  • Most commonly run on Linux servers
  • Can also run on other operating systems

Monitor your Postgres database

  • Use software as a service monitoring or open source options like Datadog, PG Analyze, and New Relic
  • Keep an eye on memory, disk usage, locks, and cache hit ratio

Set up backups

  • Make sure to have a fully managed Postgres option or manage your own backups
  • Check pg_backrest for a more robust backup solution
  • Use pg_restore to recover from backups

Practice, practice, practice

  • Use pg_sta_activity to track query plans
  • Run queries and cron jobs
  • Check pg_stat_statements for slow queries

Know how to troubleshoot

  • Look at query plans with Explain
  • Set statement timeout to prevent query hang-ups
  • Check binar logs for slow queries

Keep your Postgres instance up to date

  • Run maintenance tasks regularly
  • Use pg_stat_statements to track query plans

Set up connections

  • Set max connections to avoid overload
  • Use pg_stat_activity to track query plans
  • Check cache hit ratio

Secure your Postgres instance

  • Use SSL for database connections
  • Monitor your database with software as a service or open source options