Setting the file. One moment.
Skill 01 · Supabase Postgres Best Practices
Subchapter 1.3
references/_template.mdMarkdown1 KBView on GitHub
[1-2 sentence explanation of the problem and why it matters. Focus on performance impact.]
Incorrect (describe the problem):
-- Comment explaining what makes this slow/problematic
CREATE INDEX users_email_idx ON users(email);
SELECT * FROM users WHERE email = 'user@example.com' AND deleted_at IS NULL;
-- This scans deleted records unnecessarilyCorrect (describe the solution):
-- Comment explaining why this is better
CREATE INDEX users_active_email_idx ON users(email) WHERE deleted_at IS NULL;
SELECT * FROM users WHERE email = 'user@example.com' AND deleted_at IS NULL;
-- Only indexes active users, 10x smaller index, faster queries[Optional: Additional context, edge cases, or trade-offs]
Reference: Postgres Docs (opens in a new tab)