postgres-patterns

Optimize PostgreSQL schema, indexing and query performance with proven patterns.

20|3|Updated Apr 30, 2026
One-click install
npx skills add https://github.com/DVNghiem/FlowDeck --skill postgres-patterns-dvnghiem
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/DVNghiem/FlowDeck/tree/main/src/skills/postgres-patterns
Command: npx skills add https://github.com/DVNghiem/FlowDeck --skill postgres-patterns-dvnghiem

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

PostgreSQL performance and design challenges are addressed by providing proven patterns for schema design, indexing strategy, and query optimization.

Core Features & Use Cases

  • Design indexes strategically: Create individual btree indexes for common queries; use explain analyze to validate plans.
  • Choose correct index types and maintain statistics: B-tree vs bloom indexes, plus regular ANALYZE and statistics tuning.
  • Use parameterized queries and repository patterns: Encourage safe, reusable data access code.
  • Use case: When migrating from a naive index approach, apply patterns to reduce query time and improve planner efficiency.

Quick Start

Apply these patterns to optimize your PostgreSQL schema, indexing, and query performance in real projects.

Frequently Asked Questions about postgres-patterns

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

FAQPage Schema
How do I use EXPLAIN ANALYZE to fix PostgreSQL query performance?

Use EXPLAIN ANALYZE to validate query plans and identify sequential scans. Apply proven indexing patterns like individual btree indexes for common queries to reduce query time and improve planner efficiency.

What's the best way to design indexes for PostgreSQL performance tuning?

PostgreSQL indexing strategy requires creating individual btree indexes for common queries, choosing correct index types like B-tree vs bloom, and running regular ANALYZE to maintain statistics for optimal planner decisions.

Why does my PostgreSQL query planner choose a bad execution plan?

The PostgreSQL query planner makes poor decisions when statistics are outdated. Run regular ANALYZE to update table statistics, tune statistics parameters, and use parameterized queries to ensure consistent optimal planner decisions.

How to optimize PostgreSQL schema design for transactional and analytical workloads?

Optimize PostgreSQL schema design by applying proven patterns across transactional and analytical workloads. Use strategic indexing, parameterized queries, and repository patterns to encourage safe, reusable data access code.

When should I use bloom indexes instead of btree in PostgreSQL?

Choose bloom indexes over btree in PostgreSQL when handling specific multi-column query patterns. Validate the index type selection using EXPLAIN ANALYZE to confirm the planner utilizes the chosen index for your workload.

Can parameterized queries improve PostgreSQL performance?

Parameterized queries improve PostgreSQL performance by enabling safe, reusable data access code. Combined with repository patterns, they ensure consistent planner decisions and reduce overhead in transactional and analytical workloads.