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.
references/_template.md
1---2title: Clear, Action-Oriented Title (e.g., "Use Partial Indexes for Filtered Queries")3impact: MEDIUM4impactDescription: 5-20x query speedup for filtered queries5tags: indexes, query-optimization, performance6---78## [Rule Title]910[1-2 sentence explanation of the problem and why it matters. Focus on performance impact.]1112**Incorrect (describe the problem):**1314```sql15-- Comment explaining what makes this slow/problematic16CREATE INDEX users_email_idx ON users(email);1718SELECT * FROM users WHERE email = '[email protected]' AND deleted_at IS NULL;19-- This scans deleted records unnecessarily20```2122**Correct (describe the solution):**2324```sql25-- Comment explaining why this is better26CREATE INDEX users_active_email_idx ON users(email) WHERE deleted_at IS NULL;2728SELECT * FROM users WHERE email = '[email protected]' AND deleted_at IS NULL;29-- Only indexes active users, 10x smaller index, faster queries30```3132[Optional: Additional context, edge cases, or trade-offs]3334Reference: [Postgres Docs](https://www.postgresql.org/docs/current/)35