supabase-postgres-best-practices

Correct Supabase Postgres query, indexing, schema, and concurrency anti-patterns.

2|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/iadr-dev/colab --skill supabase-postgres-best-practices-iadr-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-postgres-best-practices
Source: https://github.com/iadr-dev/colab/tree/main/skills/coding/supabase-postgres-best-practices
Command: npx skills add https://github.com/iadr-dev/colab --skill supabase-postgres-best-practices-iadr-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps you fix slow, unstable, and insecure PostgreSQL performance by applying Supabase-focused best practices for queries, indexing, connections, schema design, concurrency, monitoring, and RLS.

Core Features & Use Cases

  • Performance rules across major categories: Covers query performance, connection management, security & RLS, schema design, locking/concurrency, data access patterns, monitoring/diagnostics, and advanced features.
  • Actionable “incorrect vs correct” SQL patterns: Each rule provides anti-patterns and improved SQL with explanations and expected performance impact.
  • Priority-guided decisioning: Organized into impact levels and rule prefixes (query-, conn-, security-, schema-, lock-, data-, monitor-, advanced-) so you can address the biggest bottlenecks first.
  • Use Case: When a production Supabase app suffers from slow filtered queries and occasional timeouts, use this skill to identify missing or wrong indexes, improve connection handling and timeouts, and adjust RLS policy patterns to avoid per-row performance traps.

Quick Start

Use this skill to review the slow SQL and schema/query patterns in your project and generate corrected, index-aware Postgres statements following the prioritized rules in the 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 Supabase Postgres queries?

To optimize slow Supabase Postgres queries, you correct query, indexing, and schema anti-patterns. This skill provides concrete incorrect versus correct SQL rewrites and prioritizes indexing improvements to directly reduce filtered query latency.

How does connection pooling affect Supabase database performance?

Connection pooling affects Supabase performance by mitigating connection limits and preventing timeouts during production bottlenecks. Implementing proper connection management and timeouts ensures stable database concurrency under high application load.

Why does my Supabase RLS policy cause per-row performance issues?

Supabase RLS policies cause per-row performance issues when security rules trigger inefficient query execution plans. Adjusting RLS policy patterns to avoid per-row traps and applying index-aware Postgres statements resolves these security-related bottlenecks.

What is the best way to use EXPLAIN ANALYZE for Postgres query tuning?

The best way to use EXPLAIN ANALYZE for Postgres query tuning is to diagnose production bottlenecks from monitoring data and execution plans. This skill applies prioritized rule categories to translate EXPLAIN output into corrected, index-aware SQL statements.

Can I fix lock contention and concurrency issues in Supabase Postgres?

You can fix lock contention and concurrency issues in Supabase Postgres by applying specific locking mitigation best practices. This skill addresses concurrency anti-patterns to ensure stable data access during schema migrations and heavy transactional loads.