supabase-postgres-best-practices

Guide Postgres query, schema, indexing, and connection decisions for Supabase applications.

Updated May 4, 2026
One-click install
npx skills add https://github.com/Endsi3g/Uprising-AOS --skill supabase-postgres-best-practices-endsi3g
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-postgres-best-practices
Source: https://github.com/Endsi3g/Uprising-AOS/tree/main/.agents/skills/supabase-postgres-best-practices
Command: npx skills add https://github.com/Endsi3g/Uprising-AOS --skill supabase-postgres-best-practices-endsi3g

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves slow queries, inefficient schema design, connection exhaustion, and unsafe security/RLS patterns by providing prioritized, concrete Postgres performance optimization guidance tailored for Supabase deployments.

Core Features & Use Cases

  • Query performance improvements: identify missing indexes, choose the right index types, and use covering/composite/partial indexes to reduce scans and heap lookups.
  • Connection and concurrency hardening: apply connection limits, idle/timeout settings, pooling patterns, and transaction/lock strategies (including deadlock prevention and SKIP LOCKED queue processing).
  • Security correctness and RLS performance: implement database-enforced RLS and optimize policy structure for performance under real multi-tenant workloads.

Quick Start

Use this skill to review your slow SQL and schema changes by asking: “Optimize the following Postgres query and explain what to change using these Supabase best practices: [paste query + schema context].”

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?

To optimize slow Postgres queries in Supabase, identify missing indexes and apply composite, partial, or covering indexes to reduce sequential scans and heap lookups. This skill guides query tuning by comparing incorrect versus correct SQL patterns for better performance.

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

Configuring connection pooling in Supabase requires applying connection limits, idle timeouts, and pooling patterns to prevent exhaustion. This skill provides rules for concurrency hardening and transaction management to maintain database reliability under load.

How does Row Level Security (RLS) affect Postgres performance in Supabase?

Row Level Security (RLS) affects Postgres performance by adding policy checks to queries, potentially slowing multi-tenant workloads if unoptimized. This skill helps structure RLS policies for performance while maintaining database-enforced security correctness.

How do I prevent deadlocks and manage locks in Supabase Postgres?

To prevent deadlocks and manage locks in Supabase Postgres, apply specific transaction and lock strategies including SKIP LOCKED queue processing. This skill provides concurrency control rules to avoid deadlocks and handle concurrent database operations safely.

Can I use this skill to review my SQL schema migrations for Supabase?

Yes, you can use this skill to review SQL schema migrations for Supabase by asking it to optimize your queries and schema changes using Supabase best practices. It applies during migration design and code review to guide indexing and schema decisions.