postgresql-best-practices

Provide PostgreSQL best practices for schema design, indexing, and query optimization.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/vorluno/Vorluno-Planilla --skill postgresql-best-practices-vorluno
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgresql-best-practices
Source: https://github.com/vorluno/Vorluno-Planilla/tree/main/.agents/skills/postgresql-best-practices
Command: npx skills add https://github.com/vorluno/Vorluno-Planilla --skill postgresql-best-practices-vorluno

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance to improve PostgreSQL database performance, reliability, and security through best practices in schema design, indexing, query optimization, and administration.

Core Features & Use Cases

  • Schema Design: Guidance on data types, table structures, and partitioning for efficient data storage.
  • Indexing Strategies: Best practices for choosing and maintaining indexes to speed up queries.
  • Query Optimization: Techniques like EXPLAIN ANALYZE, CTEs, and window functions for efficient data retrieval.
  • JSONB Optimization: Specific advice for leveraging and indexing JSONB data.
  • Connection & Transaction Management: Recommendations for pooling, isolation levels, and locking.
  • Maintenance & Security: Best practices for vacuuming, backups, SSL, RLS, and role-based access control.
  • Use Case: A developer struggling with slow database queries can consult this Skill to understand how to analyze query plans, add appropriate indexes, and refactor their SQL for better performance.

Quick Start

Use the postgresql-best-practices skill to learn about optimizing JSONB queries.

Frequently Asked Questions about postgresql-best-practices

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

FAQPage Schema
How do I optimize slow PostgreSQL queries using EXPLAIN ANALYZE?

PostgreSQL query optimization uses EXPLAIN ANALYZE to inspect query plans, identify bottlenecks like sequential scans, and apply best practices for CTEs, window functions, and appropriate indexes to speed up data retrieval.

What's the best way to design a PostgreSQL schema for efficient data storage?

The best way to design a PostgreSQL schema is to use native data types, normalize table structures, and apply partitioning strategies to ensure efficient data storage and improve overall database performance.

When do I need GIN or GiST indexes in PostgreSQL?

You need GIN or GiST indexes in PostgreSQL when handling complex data searches, such as optimizing JSONB queries or full-text search, as these indexing strategies significantly speed up data retrieval beyond standard B-tree indexes.

How does PostgreSQL connection pooling and transaction management improve reliability?

PostgreSQL connection pooling and transaction management improve reliability by managing isolation levels, reducing connection overhead, and controlling locking, which ensures consistent data access under high concurrency.

What PostgreSQL maintenance tasks and security measures should I implement?

Essential PostgreSQL maintenance and security tasks include running VACUUM for space reclamation, configuring backup strategies, and enforcing security through SSL, Row Level Security (RLS), and role-based access control.