postgres-patterns

Optimizes PostgreSQL queries, designs schemas/indexes, hardens security with RLS and migrations.

16|3|Updated Mar 12, 2026
One-click install
npx skills add https://github.com/sehoon787/my-claude --skill postgres-patterns-sehoon787
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/sehoon787/my-claude/tree/main/skills/ecc/postgres-patterns
Command: npx skills add https://github.com/sehoon787/my-claude --skill postgres-patterns-sehoon787

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL database patterns provide proven techniques for optimizing queries, designing robust schemas, implementing efficient indexing, and hardening security following Supabase best practices.

Core Features & Use Cases

  • Quick reference for common patterns including B-tree, GIN, BRIN index usage; upsert, and RLS policies.
  • Use cases include designing schemas, optimizing migrations, improving query performance, and securing data.

Quick Start

Read the PostgreSQL patterns and apply the recommended best practices to your current database design and queries.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
How do I optimize PostgreSQL query performance using advanced indexing strategies?

PostgreSQL query optimization uses B-tree, GIN, and BRIN index patterns to accelerate data retrieval. Selecting the correct index type based on query structure and data distribution drastically reduces execution time and improves overall database performance.

What is the best way to implement UPSERT operations in PostgreSQL?

UPSERT operations in PostgreSQL use the ON CONFLICT clause to insert or update rows atomically. This pattern prevents race conditions and duplicate records during concurrent data migrations or ingestion workflows.

How do Row Level Security RLS policies work in PostgreSQL?

Row Level Security RLS policies in PostgreSQL restrict data access at the row level based on user roles. Applying these policy patterns ensures secure data isolation directly within the database, following Supabase best practices.

When should I use a GIN index versus a BRIN index in PostgreSQL?

Use a GIN index for full-text search or JSONB queries, and a BRIN index for large tables with naturally ordered data. Choosing the correct PostgreSQL indexing pattern ensures efficient storage and fast query filtering.

Can I apply these PostgreSQL patterns to secure data and optimize migrations?

Yes, these PostgreSQL patterns apply directly to schema design, query tuning, and migration optimization. They deliver configuration guidance and practical examples to harden security and improve performance across deployments.