postgres-patterns

Provide PostgreSQL optimization patterns for schema design, indexing, and security.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/thanhquan3010/hospital-service-management-system --skill postgres-patterns-thanhquan3010
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-patterns
Source: https://github.com/thanhquan3010/hospital-service-management-system/tree/main/.agent/skills/postgres-patterns
Command: npx skills add https://github.com/thanhquan3010/hospital-service-management-system --skill postgres-patterns-thanhquan3010

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides quick reference and best practices for PostgreSQL database design, query optimization, indexing, and security, helping developers write more efficient and robust SQL.

Core Features & Use Cases

  • Query Optimization: Guidance on writing efficient SQL queries.
  • Schema Design: Best practices for data types and table structures.
  • Indexing Strategies: Recommendations for B-tree, GIN, BRIN, composite, covering, and partial indexes.
  • Security: Tips for Row Level Security (RLS) policies.
  • Use Case: When encountering slow query performance, consult this Skill for index suggestions or anti-pattern detection.

Quick Start

Use the postgres-patterns skill to find an example of a composite index.

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?

Optimize slow PostgreSQL queries by applying best practices for query tuning, schema design, and targeted indexing strategies. This Skill provides references to detect anti-patterns and implement efficient SQL structures for better performance.

What is the best way to design a PostgreSQL schema for performance?

Designing a PostgreSQL schema for performance requires selecting optimal data types and structuring tables to prevent bottlenecks. This resource offers schema design best practices to ensure your database structure supports efficient data retrieval.

When should I use partial or covering indexes in PostgreSQL?

Use partial or covering indexes in PostgreSQL to optimize specific query patterns while reducing storage overhead. This Skill details index strategies including B-tree, GIN, BRIN, composite, and partial indexes to improve query speed.

How do I implement Row Level Security in PostgreSQL?

Implement Row Level Security (RLS) in PostgreSQL by configuring specific database policies to restrict data access. This Skill provides security tips and configuration templates for setting up RLS policies effectively.

What are common PostgreSQL anti-patterns I should avoid?

Common PostgreSQL anti-patterns include poor data type selection, inefficient query structures, and improper indexing. This Skill helps identify these database design issues and offers configuration templates to correct performance bottlenecks.

Does this resource provide configuration templates for database monitoring?

Yes, this PostgreSQL optimization resource provides configuration templates for performance tuning and monitoring. These templates help you establish baseline settings to maintain database efficiency and track query health.