mcpField
P
postgres-best-practices

postgres-best-practices

github.com/neondatabaseData & databases531.9k installsUpdated 9w ago
Repository

About postgres-best-practices

postgres-best-practices is a practical guide for PostgreSQL users, covering versions 14 through 18. Its topic-based references address database design, query performance, operations, security, and migrations.

Key features

  1. 01Covers PostgreSQL 14 through 18
  2. 02Guidance on schema design and indexing
  3. 03Query optimization and common patterns
  4. 04Performance diagnostics and connection pooling
  5. 05Replication, backup, and recovery guidance
  6. 06Security, upgrades, and bulk loading

Use cases

  1. 01Design tables, data types, and partitions
  2. 02Analyze EXPLAIN ANALYZE and diagnose bottlenecks
  3. 03Plan logical replication or a major-version upgrade
  4. 04Configure privileges, backups, and connection pooling

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/neondatabase/postgres-skills --skill postgres-best-practices

After installing, type/postgres-best-practicesin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
backup-restore.md
bulk-loading.md
connection-pooling.md
hot-standby.md
indexing.md
logical-replication.md
major-version-upgrades.md
performance-diagnostics.md
query-optimization.md
query-patterns.md
schema-design.md
security-roles.md
transaction-isolation.md

Details

From the project README

Postgres Best Practices

Guidelines and best practices for working with Postgres, covering schema design, indexing, query optimization, and common pitfalls.

Supported Versions

This skill covers PostgreSQL 14 through 18. Version-specific features are tagged (e.g., [PG15+], [PG18+]); environment-dependent examples identify required privileges, extensions, or multi-node setup.

PostgreSQL provides 5 years of support per major version. Always run the latest minor release.

VersionInitial ReleaseEnd of Life
18September 2025November 2030
17September 2024November 2029
16September 2023November 2028
15October 2022November 2027
14September 2021November 2026

Source: postgresql.org/support/versioning

References

AreaResourceWhen to Use
Schema Designreferences/schema-design.mdDesigning tables, choosing data types, normalizing, partitioning
Indexingreferences/indexing.mdChoosing index types, composite indexes, partial/covering indexes
Query Optimizationreferences/query-optimization.mdReading EXPLAIN ANALYZE, fixing bottlenecks, planner tuning
Query Patternsreferences/query-patterns.mdCTEs, window functions, lateral joins, UPSERT, JSONB, anti-patterns
Performance Diagnosticsreferences/performance-diagnostics.mdpg_stat views, lock analysis, VACUUM, connection management
Logical Replicationreferences/logical-replication.mdPub/sub replication, live migrations, CDC
Hot Standbyreferences/hot-standby.mdStreaming replication, read replicas, failover
Transaction Isolationreferences/transaction-isolation.mdIsolation levels, lost updates, serialization failures, retry logic
Backup & Restorereferences/backup-restore.mdpg_dump/pg_restore, pg_basebackup, PITR, recovery
Security & Rolesreferences/security-roles.mdPrivileges, RLS, pg_hba.conf, authentication, SSL
Bulk Data Loadingreferences/bulk-loading.mdCOPY patterns, ETL staging, optimizing large loads, batch ops
Connection Poolingreferences/connection-pooling.mdPgBouncer config, pool modes, prepared statements, sizing
Major Version Upgradesreferences/major-version-upgrades.mdpg_upgrade, logical replication migration, pre/post checklists

Comments

Markdown supported