supabase-postgres-best-practices

Optimize Supabase Postgres schemas, indexes, and queries with best practices.

Updated May 3, 2026
One-click install
npx skills add https://github.com/LuisElPoti/launch-signal-dashboard --skill supabase-postgres-best-practices-luiselpoti
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-postgres-best-practices
Source: https://github.com/LuisElPoti/launch-signal-dashboard/tree/main/.agents/skills/supabase-postgres-best-practices
Command: npx skills add https://github.com/LuisElPoti/launch-signal-dashboard --skill supabase-postgres-best-practices-luiselpoti

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you improve Postgres performance and reliability by providing actionable, Supabase-aligned best practices for queries, indexing, connection handling, schema design, and Row-Level Security (RLS).

Core Features & Use Cases

  • Prioritized performance rules: Guides you through the most impactful fixes first, from critical query and connection issues to incremental advanced features.
  • Anti-pattern to best-practice examples: Each rule includes clearly labeled incorrect vs. correct SQL patterns to help you refactor confidently.
  • Operational guidance for common pain points: Covers missing/partial/composite/covering indexes, pagination strategy, batch vs. N+1 access patterns, vacuum/ANALYZE, and RLS performance tuning.
  • Connection and locking safety: Provides best practices for pooling, timeouts, prepared statements in pooled environments, and avoiding deadlocks with consistent ordering.

Quick Start

Ask the AI to review your slow query or schema and recommend the highest-priority fixes using the rule categories and incorrect vs. correct examples from the Supabase Postgres best practices references.

Frequently Asked Questions about supabase-postgres-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I optimize slow Postgres queries in Supabase?

Fix slow Postgres queries by applying prioritized rules for query rewriting, selecting composite or covering indexes, and resolving N+1 batch access patterns using provided anti-pattern and best-practice SQL examples.

What is the best way to configure connection pooling for Supabase Postgres?

Configure connection pooling by applying best practices for pooling, timeouts, and prepared statements in pooled environments to ensure connection and locking safety. This prevents connection exhaustion and maintains database stability under load.

How does Row-Level Security (RLS) affect Postgres performance and how can I tune it?

Row-Level Security (RLS) can degrade Postgres performance if policies are poorly written. Tune RLS by applying performance optimization guidance to refactor policies, ensuring throughput remains high while maintaining strict security constraints.

When do I need partial or covering indexes for JSONB data in Postgres?

You need partial or covering indexes for JSONB data when query patterns filter on specific JSON keys or require specific columns without hitting the table. The Skill guides index selection for JSONB and Gin scenarios to maximize query speed.

What are common Postgres schema migration safety issues and how do I avoid deadlocks?

Avoid Postgres migration safety issues and deadlocks by applying consistent ordering in transactions and following locking safety best practices. The Skill provides operational guidance to prevent deadlocks and ensure stable schema changes.

Can I use keyset pagination instead of offset for large Supabase tables?

Yes, you can use keyset pagination instead of offset for large Supabase tables to improve performance. The Skill provides pagination strategy guidance as part of its operational best practices for scaling Postgres environments.