supabase-postgres-best-practices

Identify PostgreSQL/Supabase performance and reliability improvements for production deployments.

Updated May 10, 2024
One-click install
npx skills add https://github.com/asubota/lets --skill supabase-postgres-best-practices-asubota
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-postgres-best-practices
Source: https://github.com/asubota/lets/tree/main/.agents/skills/supabase-postgres-best-practices
Command: npx skills add https://github.com/asubota/lets --skill supabase-postgres-best-practices-asubota

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Postgres performance and reliability improvements for Supabase projects, providing a structured set of best practices, rules, and examples to optimize queries, indexing, and maintenance.

Core Features & Use Cases

  • Guidelines for efficient indexing (composite, partial, covering) and index types (btree, gin, gist, brin)
  • Query optimization patterns: N+1, batching, pagination, upserts, upserting and concurrency control, RLS performance tips
  • Maintenance and observability: VACUUM/ANALYZE, pg_stat_statements, EXPLAIN ANALYZE, RLS and security considerations
  • Use Case: audit and optimize a production Postgres schema in Supabase.

Quick Start

Run a configuration pass against your database to identify top slow queries and apply recommended indexing patterns.

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?

Optimize slow Postgres queries in Supabase by analyzing query plans with EXPLAIN ANALYZE and applying targeted indexing patterns. This skill provides rules for index selection, batching, and pagination to resolve performance bottlenecks.

What is the best way to choose Postgres index types for Supabase schemas?

Choosing Postgres index types for Supabase schemas involves selecting between btree, gin, gist, and brin indexes. This skill provides concrete rules for applying composite, partial, and covering indexes to match your query patterns.

Does Row Level Security (RLS) impact Supabase Postgres performance?

Row Level Security (RLS) impacts Supabase Postgres performance by adding overhead to query execution. This skill provides RLS performance tips and security considerations to maintain database speed while enforcing access control.

How do I maintain a production Postgres database in Supabase?

Maintain a production Postgres database in Supabase by running VACUUM and ANALYZE operations and monitoring with pg_stat_statements. This skill outlines maintenance and observability patterns to ensure long-term reliability.

How do I fix N+1 query problems in a Supabase Postgres backend?

Fix N+1 query problems in a Supabase Postgres backend by applying query optimization patterns like batching and upserting. This skill provides example-driven rules to restructure queries and control concurrency efficiently.

Can I use partial and covering indexes to improve Supabase query speed?

Partial and covering indexes improve Supabase query speed by indexing only relevant subsets of data and including extra columns to avoid table lookups. This skill explains when to apply these indexing patterns for optimal results.