ia-postgresql

Optimize PostgreSQL schemas, queries, and migrations with EXPLAIN ANALYZE validation.

30|3|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/iliaal/whetstone --skill ia-postgresql
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ia-postgresql
Source: https://github.com/iliaal/whetstone/tree/main/plugins/whetstone/skills/ia-postgresql
Command: npx skills add https://github.com/iliaal/whetstone --skill ia-postgresql

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you design and optimize PostgreSQL schemas and queries while avoiding common production risks like slow plans, missing indexes, unsafe migrations, and insecure row-level access.

Core Features & Use Cases

  • Schema design defaults: Apply strong data-type, constraint, and timestamp rules (including JSONB and UUID guidance) tailored to PostgreSQL.
  • Migration safety: Follow expand-contract patterns, concurrency-safe index creation, and batch-safe backfills to reduce downtime and data corruption risk.
  • Performance and correctness: Use EXPLAIN ANALYZE-driven optimization, robust indexing strategies (B-tree/GiST/GIN/BRIN), and RLS performance practices.

Quick Start

Ask the agent to "add row level security and optimize the query plan for the tenant orders table using EXPLAIN ANALYZE and the correct indexes."

Frequently Asked Questions about ia-postgresql

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

FAQPage Schema
How do I design safe PostgreSQL schema migrations without downtime?

Safe PostgreSQL schema migrations require expand-contract patterns, concurrency-safe index creation, and batch-safe backfills to reduce downtime and data corruption risk during production deployments.

What is the best way to optimize slow PostgreSQL query plans?

PostgreSQL query optimization requires running EXPLAIN (ANALYZE, BUFFERS) to inspect execution plans, then selecting appropriate indexing strategies like B-tree, GIN, GiST, or BRIN to improve performance.

How does row level security work in PostgreSQL for multi-tenant tables?

PostgreSQL row level security (RLS) restricts data access by evaluating policies per row, requiring careful indexing and performance validation through EXPLAIN ANALYZE to ensure secure tenant isolation without degrading query speed.

When should I use JSONB columns and GIN indexes in PostgreSQL?

PostgreSQL JSONB columns store semi-structured data efficiently, and GIN indexes accelerate JSONB key lookups, making them ideal when schema flexibility is needed without sacrificing query performance.

Can I use PostgreSQL CTE and window functions for complex analytics?

PostgreSQL CTE and window functions handle complex analytical logic, but require EXPLAIN ANALYZE validation to ensure the planner executes efficiently without materializing unnecessary intermediate result sets.

What are the limitations of PostgreSQL partitioning for large tables?

PostgreSQL partitioning improves maintenance and query targeting for large tables, but requires careful constraint design and partition key selection to avoid performance degradation from cross-partition scans.