Postgres Best Practices

neondatabase/postgres-skills/skills/postgres-best-practices

by neondatabase27fe45e0f71eNo license48 starsListed Oct 9, 2026Updated Oct 9, 2026Repository updated 2 days ago

Best practices and guidelines for working with Postgres. Covers schema design, indexing strategies, query optimization, migrations, and common pitfalls. Use when writing SQL, designing database schemas, optimizing queries, or setting up a Postgres database.

AI-generated overview

Guidelines for PostgreSQL schema design, indexing, query optimization, replication, backups, and security.

What it does
This skill supplies best-practice guidance for working with PostgreSQL versions 14 through 18. It routes the agent to reference documents covering schema design, indexing, query optimization, query patterns, performance diagnostics, logical replication, hot standby, transaction isolation, backup and restore, security and roles, bulk loading, connection pooling, and major version upgrades. It produces advice and recommendations rather than files or code artifacts.
When to use it
Use it when writing SQL, designing database schemas, optimizing queries, or setting up a PostgreSQL database. It is also relevant for replication, backup, security role, and version upgrade questions.
Requirements
No scripts or tools are required; it is instructions plus reference documents only. The agent needs no credentials or network access beyond reading the bundled reference files.

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

Source and attribution

Source:neondatabase/postgres-skillsinskills/postgres-best-practicesat commit27fe45e

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal