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专属特性进行优化
- 处理行级安全(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/query-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/query-partial-indexes.md
references/_sections.md每个规则文件包含:
- 规则重要性的简要说明
- 错误SQL示例及说明
- 正确SQL示例及说明
- 可选的EXPLAIN输出或指标数据
- 额外背景信息与参考资料
- Supabase专属说明(如适用)