postgres-best-practices
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSupabase Postgres Best Practices
Supabase Postgres 最佳实践
Comprehensive performance optimization guide for Postgres, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.
由Supabase维护的Postgres全面性能优化指南。包含8个类别的规则,按影响优先级排序,可指导自动化查询优化与schema设计。
When to Apply
适用场景
Reference these guidelines when:
- Writing SQL queries or designing schemas
- Implementing indexes or query optimization
- Reviewing database performance issues
- Configuring connection pooling or scaling
- Optimizing for Postgres-specific features
- Working with Row-Level Security (RLS)
参考本指南的场景:
- 编写SQL查询语句或设计数据库schema
- 实现索引或查询优化
- 排查数据库性能问题
- 配置连接池或进行扩容
- 针对Postgres专属特性进行优化
- 使用Row-Level Security (RLS)
Rule Categories by Priority
按优先级划分的规则类别
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Query Performance | CRITICAL | |
| 2 | Connection Management | CRITICAL | |
| 3 | Security & RLS | CRITICAL | |
| 4 | Schema Design | HIGH | |
| 5 | Concurrency & Locking | MEDIUM-HIGH | |
| 6 | Data Access Patterns | MEDIUM | |
| 7 | Monitoring & Diagnostics | LOW-MEDIUM | |
| 8 | Advanced Features | LOW | |
| 优先级 | 类别 | 影响程度 | 前缀 |
|---|---|---|---|
| 1 | 查询性能 | 关键 | |
| 2 | 连接管理 | 关键 | |
| 3 | 安全与RLS | 关键 | |
| 4 | Schema设计 | 高 | |
| 5 | 并发与锁机制 | 中高 | |
| 6 | 数据访问模式 | 中 | |
| 7 | 监控与诊断 | 中低 | |
| 8 | 高级特性 | 低 | |
How to Use
使用方法
Read individual rule files for detailed explanations and SQL examples:
rules/query-missing-indexes.md
rules/schema-partial-indexes.md
rules/_sections.mdEach rule file contains:
- Brief explanation of why it matters
- Incorrect SQL example with explanation
- Correct SQL example with explanation
- Optional EXPLAIN output or metrics
- Additional context and references
- Supabase-specific notes (when applicable)
阅读单个规则文件以获取详细说明及SQL示例:
rules/query-missing-indexes.md
rules/schema-partial-indexes.md
rules/_sections.md每个规则文件包含:
- 规则重要性的简要说明
- 错误SQL示例及解释
- 正确SQL示例及解释
- 可选的EXPLAIN输出或指标
- 额外背景信息及参考资料
- Supabase专属说明(如适用)
Full Compiled Document
完整编译文档
For the complete guide with all rules expanded:
AGENTS.md如需包含所有规则的完整指南,请查看:
AGENTS.mdWhen to Use
适用场景
This skill is applicable to execute the workflow or actions described in the overview.
本技能适用于执行概述中描述的工作流或操作。