postgres-patterns

Apply indexing and schema optimization patterns to improve PostgreSQL query performance.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/giuseppecutuli/speakdoc --skill postgres-patterns-giuseppecutuli
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/giuseppecutuli/speakdoc/tree/main/.claude/skills/postgres-patterns
Command: npx skills add https://github.com/giuseppecutuli/speakdoc --skill postgres-patterns-giuseppecutuli

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL performance issues are solved by applying proven patterns to optimize queries, schemas, and security configurations.

Core Features & Use Cases

  • Query optimization patterns for indexing, execution plans, and join strategies.
  • Schema design best practices, including normalization, denormalization trade-offs, and constraints.
  • Security considerations including Row Level Security, policies, and least-privilege access patterns.
  • Use Case: when optimizing a slow transaction-heavy application, apply composite indexes and partial indexes to reduce latency.

Quick Start

Apply a representative pattern such as adding a composite index on (col1, col2) to accelerate slow 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 slow PostgreSQL queries in a transaction-heavy application?

To optimize slow PostgreSQL queries, apply proven patterns like adding composite indexes on frequently filtered columns and using partial indexes to reduce latency. These indexing strategies accelerate query execution by minimizing table scans during high-volume transactions.

What are the best PostgreSQL schema design patterns for balancing normalization and performance?

PostgreSQL schema design patterns involve evaluating normalization alongside denormalization trade-offs to balance data integrity and query performance. Applying proper constraints ensures consistency while strategically denormalizing tables accelerates read-heavy workloads.

How does Row Level Security work for implementing least-privilege access in PostgreSQL?

Row Level Security in PostgreSQL works by defining policies that restrict row access based on user roles, enabling least-privilege access patterns. This ensures users only query and modify data they are explicitly authorized to handle.

Can I apply these PostgreSQL indexing and query optimization patterns in a Supabase deployment?

Yes, you can apply these PostgreSQL query optimization and indexing patterns in a Supabase deployment. The patterns align with Supabase best practices and modern PostgreSQL features, supporting both development and production environments.

When should I use partial indexes instead of composite indexes for PostgreSQL query tuning?

Use partial indexes for PostgreSQL query tuning when queries target a specific subset of rows, reducing index size and maintenance overhead. Composite indexes are better when multiple columns are frequently filtered together in join strategies.

What PostgreSQL execution plan patterns help diagnose query performance bottlenecks?

PostgreSQL execution plan patterns help diagnose query performance bottlenecks by analyzing sequential scans, join strategies, and index usage. Applying these patterns identifies missing indexes and inefficient joins to guide query optimization decisions.