postgres-patterns

Diagnose PostgreSQL performance, schema, and security configuration issues.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/luongldptit/move-ticket --skill postgres-patterns-luongldptit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/luongldptit/move-ticket/tree/main/.agent/skills/postgres-patterns
Command: npx skills add https://github.com/luongldptit/move-ticket --skill postgres-patterns-luongldptit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates common PostgreSQL performance bottlenecks, schema design flaws, and security misconfigurations that lead to slow queries, excessive data bloat, and unauthorized data access, saving developers hours of manual debugging and optimization work.

Core Features & Use Cases

  • Optimized Indexing Guidance: Provides cheat sheets for selecting the right index type (B-tree, GIN, BRIN) for common query patterns, plus best practices for composite, covering, and partial indexes to boost query performance.
  • Schema & Query Best Practices: Includes recommended data types, reusable SQL patterns for upserts, cursor pagination, and queue processing, plus anti-pattern detection queries to identify unindexed foreign keys, slow queries, and table bloat.
  • Security & Configuration Templates: Offers optimized row level security policy examples and pre-vetted PostgreSQL configuration templates for connection limits, timeouts, and monitoring to improve application security and stability.
  • Use Case Example: If you are building a multi-tenant SaaS application, use this Skill to quickly implement proper row level security policies and optimized composite indexes for user-specific data queries.

Quick Start

Use the postgres-patterns skill to create an optimized composite index and row level security policy for a multi-tenant orders table that filters by user_id and created_at.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
How do I choose the right PostgreSQL index type for slow query performance?

PostgreSQL schema design anti-patterns include unindexed foreign keys causing slow joins, improper data type selection leading to data bloat, and missing composite indexes for multi-tenant queries. Detection queries help identify these table bloat and performance bottlenecks.

How do I implement row level security for a multi-tenant PostgreSQL application?

Row level security in PostgreSQL restricts data access per tenant. Apply policy templates to filter user-specific data queries by user_id, ensuring authorized data access while maintaining optimized query performance for multi-tenant SaaS applications.

What are the best PostgreSQL configuration defaults for connection pooling and timeouts?

PostgreSQL configuration defaults for production require setting connection limits, timeout thresholds, and monitoring parameters. Pre-vetted templates provide stability by preventing connection exhaustion and ensuring reliable database operations under load.

Can I use PostgreSQL cursor pagination and upsert SQL patterns for queue processing?

PostgreSQL cursor pagination and upserts are reusable SQL patterns for queue processing. These templates handle concurrent data modifications efficiently, preventing race conditions while maintaining data integrity during high-volume transaction processing.