postgres-best-practices

Best practices and guidelines for working with Postgres. Covers schema design, indexing strategies, query optimization, migrations, and common pitfalls. Use…

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

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

More skills from neondatabase

claimable-postgres
neondatabase
Instant Postgres databases for local development, demos, prototyping, and test environments. No account required. Databases expire after 72 hours unless claimed to a Neon account.
neon
neondatabase
Overview of the Neon platform for apps and agents, spanning Postgres, Auth, Data API, and the new services: Object Storage, Compute Functions, and AI Gateway. Use whenever "Neon" is mentioned for an overview of how to work with Neon and how to get started. Otherwise, the individual capabilities are the triggers: "object storage" or "S3-compatible storage", "serverless functions", "background jobs", or "run code near my database", "AI gateway", "LLM proxy", "model routing", or "call an LLM" →...
apidatabasedevelopment
plugin-manager
neondatabase
Manage plugin structure and configuration for this repository across both Cursor and Claude Code. Use when creating, updating, or reviewing plugin folders…
skill-creator
neondatabase
Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's…
using-neon
neondatabase
Guides and best practices for working with Neon Serverless Postgres. Covers getting started, local development with Neon, choosing a connection method, Neon…
neon-js-react
neondatabase
Sets up the full Neon SDK with authentication AND database queries in React apps (Vite, CRA). Creates typed client, generates database types, and configures…
neon-postgres-egress-optimizer
neondatabase
Guide the user through diagnosing and fixing application-side query patterns that cause excessive data transfer (egress) from their Postgres database. Most high egress bills come from the application fetching more data than it uses.
neon-postgres-branches
neondatabase
The outcome of this skill should be a created Neon branch (or a clear, actionable next step if creation cannot proceed). Choose the correct branch type, then execute branch creation via MCP or CLI.