Postgres Best Practices

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

作者 neondatabase27fe45e0f71e无许可证48 个星标收录于 2026年10月9日更新于 2026年10月9日仓库2天前更新

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 生成的概览

提供 PostgreSQL 模式设计、索引、查询优化、复制、备份与安全方面的最佳实践指南。

功能
该技能提供针对 PostgreSQL 14 至 18 版本的最佳实践指导。它会引导代理查阅参考文档,内容涵盖模式设计、索引、查询优化、查询模式、性能诊断、逻辑复制、热备、事务隔离、备份与恢复、安全与角色、批量加载、连接池以及大版本升级。它产出的是建议和推荐,而不是文件或代码产物。
适用场景
在编写 SQL、设计数据库模式、优化查询或搭建 PostgreSQL 数据库时使用。它也适用于复制、备份、安全角色和版本升级相关问题。
运行要求
不需要脚本或工具,仅为说明文档加参考文档。除读取随附的参考文件外,代理无需凭据或网络访问。

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

来源与署名

来源:neondatabase/postgres-skills位于skills/postgres-best-practices提交27fe45e

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架