supabase-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个类别的规则,按影响优先级排序,可指导自动化查询优化和架构设计。
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查询或设计数据库架构
- 实现索引或查询优化
- 排查数据库性能问题
- 配置连接池或进行扩容
- 针对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 | 架构设计 | 高 | |
| 5 | 并发与锁 | 中高 | |
| 6 | 数据访问模式 | 中 | |
| 7 | 监控与诊断 | 中低 | |
| 8 | 高级功能 | 低 | |
How to Use
使用方法
Read individual rule files for detailed explanations and SQL examples:
references/query-missing-indexes.md
references/schema-partial-indexes.md
references/_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示例:
references/query-missing-indexes.md
references/schema-partial-indexes.md
references/_sections.md每个规则文件包含:
- 简要说明该规则的重要性
- 错误的SQL示例及解释
- 正确的SQL示例及解释
- 可选的EXPLAIN输出或指标
- 额外的背景信息和参考资料
- 特定于Supabase的说明(如适用)