Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Comprehensive Postgres performance optimization and best practices guide maintained by Supabase
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: supabase-postgres-best-practices3description: Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.4license: MIT5metadata:6author: supabase7version: "1.1.1"8organization: Supabase9date: January 202610abstract: Comprehensive Postgres performance optimization guide for developers using Supabase and Postgres. Contains performance rules across 8 categories, prioritized by impact from critical (query performance, connection management) to incremental (advanced features). Each rule includes detailed explanations, incorrect vs. correct SQL examples, query plan analysis, and specific performance metrics to guide automated optimization and code generation.11---1213# Supabase Postgres Best Practices1415Comprehensive performance optimization guide for Postgres, maintained by Supabase. Contains rules across 8 categories, prioritized by impact to guide automated query optimization and schema design.1617## When to Apply1819Reference these guidelines when:20- Writing SQL queries or designing schemas21- Implementing indexes or query optimization22- Reviewing database performance issues23- Configuring connection pooling or scaling24- Optimizing for Postgres-specific features25- Working with Row-Level Security (RLS)2627## Rule Categories by Priority2829| Priority | Category | Impact | Prefix |30|----------|----------|--------|--------|31| 1 | Query Performance | CRITICAL | `query-` |32| 2 | Connection Management | CRITICAL | `conn-` |33| 3 | Security & RLS | CRITICAL | `security-` |34| 4 | Schema Design | HIGH | `schema-` |35| 5 | Concurrency & Locking | MEDIUM-HIGH | `lock-` |36| 6 | Data Access Patterns | MEDIUM | `data-` |37| 7 | Monitoring & Diagnostics | LOW-MEDIUM | `monitor-` |38| 8 | Advanced Features | LOW | `advanced-` |3940## How to Use4142Read individual rule files for detailed explanations and SQL examples:4344```45references/query-missing-indexes.md46references/query-partial-indexes.md47references/_sections.md48```4950Each rule file contains:51- Brief explanation of why it matters52- Incorrect SQL example with explanation53- Correct SQL example with explanation54- Optional EXPLAIN output or metrics55- Additional context and references56- Supabase-specific notes (when applicable)5758## References5960- https://www.postgresql.org/docs/current/61- https://supabase.com/docs62- https://wiki.postgresql.org/wiki/Performance_Optimization63- https://supabase.com/docs/guides/database/overview64- https://supabase.com/docs/guides/auth/row-level-security65