Skip to content
Back to skills

Postgresql Optimization

ASecurity

PostgreSQL-specific development — JSONB, arrays, custom/range types, full-text search, window functions, indexing, and extensions. Use when writing, tuning, or modeling anything on PostgreSQL.

  • 4 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 19, 2026
ai-agentssqlexpressdatabaseperformance

Works with

  • cursor

Security analysis

A100/100

Pro scans all 4 files and shows the line behind each finding

Scanned September 19, 2026

npx -y skills add jgamaraalv/delivery-loop --skill postgresql-optimization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Postgresql Optimization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Postgresql Optimization
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jgamaraalv-postgresql-optimization/badge)](https://www.skillsdirectory.com/skills/jgamaraalv-postgresql-optimization)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: postgresql-optimization
description: PostgreSQL-specific development — JSONB, arrays, custom/range types, full-text search, window functions, indexing, and extensions. Use when writing, tuning, or modeling anything on PostgreSQL.
---

# PostgreSQL Optimization

You are a PostgreSQL specialist. Leverage what makes PostgreSQL special — its type system, index variety, and extension ecosystem — rather than treating it as a generic SQL database (for cross-database tuning, prefer the sibling `sql-optimization` skill).

## Core Principles

- Measure before optimizing: `EXPLAIN (ANALYZE, BUFFERS)` for a query, `pg_stat_statements` for the workload.
- Match the index type to the data type: B-tree for scalars, GIN for JSONB/arrays/tsvector, GiST for ranges and geometry.
- Query JSONB and arrays with indexable operators (`@>`, `?`, `&&`) — not text casts or `ANY()` on large tables.
- Prefer PostgreSQL-native modeling: ENUMs and domains over free VARCHAR, `TIMESTAMPTZ` over `TIMESTAMP`, range types with `EXCLUDE` constraints over app-side overlap checks.
- Paginate by cursor (keyset), never by large OFFSET; replace correlated subqueries with window functions.
- Keep the planner honest: regular `VACUUM`/`ANALYZE`, partition large tables, pool connections (pgbouncer).

## References

Each file is loaded on demand — read one only when the task needs that depth (progressive disclosure).

- `references/advanced-data-types.md` — JSONB, arrays, custom types & domains, range types (with `EXCLUDE` constraints), geometric types, and the GIN/GiST indexes each needs · read when modeling schemas or querying these types.
- `references/query-performance.md` — EXPLAIN-driven analysis, index strategies (composite, partial, expression, covering), window functions, recursive CTEs, full-text search, pagination & aggregation patterns · read when a query is slow or you're designing indexes.
- `references/extensions-monitoring.md` — the extension ecosystem (uuid-ossp, pgcrypto, pg_trgm, …), slow-query/index-usage/size monitoring, connection & memory management, routine maintenance · read when picking extensions or operating an instance.

Files in this skill

  • SKILL.md2.1 KB
  • references/advanced-data-types.md3.6 KB
  • references/extensions-monitoring.md2.7 KB
  • references/query-performance.md4.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…