postgres-column-design

Decide between JSONB and relational columns using a three-gate framework.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/lgerard314/global-plugin --skill postgres-column-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-column-design
Source: https://github.com/lgerard314/global-plugin/tree/main/plugin/skills/postgres-column-design
Command: npx skills add https://github.com/lgerard314/global-plugin --skill postgres-column-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Decide whether a new or evolving schema should store data in a JSONB column or in normalized relational columns, balancing flexibility with queryability, integrity, and performance.

Core Features & Use Cases

  • Gate-based decision framework for column shape (Gate 1: Shape, Gate 2: Access, Gate 3: Cost) to decide between JSONB and relational design.
  • Clear rules on indexing and query patterns for JSONB (GIN, jsonb_path_ops, expression or partial indexes) and when to stage data.
  • Use cases across table design, adding JSONB fields, and reviewing schema changes that introduce JSONB payloads.

Quick Start

Analyze a schema change to decide whether to use JSONB or relational columns, applying the three gates and recommended indexes.

Frequently Asked Questions about postgres-column-design

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

FAQPage Schema
How do I decide between JSONB and relational columns for a PostgreSQL schema?

To decide between JSONB and relational columns in PostgreSQL, apply a three-gate framework evaluating data shape, access patterns, and storage costs. This balances flexibility against queryability, integrity, and performance.

When should I decompose a JSONB blob into normalized relational columns?

You should decompose a JSONB blob into normalized relational columns when query access patterns require strict integrity and frequent updates. The framework evaluates whether the JSONB payload's structure is stable enough to benefit from relational constraints.

What indexes are recommended for querying PostgreSQL JSONB columns?

For querying PostgreSQL JSONB columns, recommended indexes include GIN, jsonb_path_ops, expression indexes, and partial indexes. The specific choice depends on your query patterns and whether you need to index the entire document or specific keys.

Does storing data in PostgreSQL JSONB columns impact TOAST and WAL performance?

Yes, storing large data in PostgreSQL JSONB columns impacts TOAST and WAL performance. JSONB payloads can trigger TOAST out-of-line storage and increase WAL write costs, which the decision framework evaluates to prevent performance degradation.

How do I review a schema.prisma change that introduces a JSONB field?

To review a schema.prisma change that introduces a JSONB field, analyze the widening schema using the three-gate framework. This ensures the new JSONB field satisfies shape, access, and cost requirements before implementation.

What is the best way to structure PostgreSQL database designs for flexible data?

The best way to structure PostgreSQL database designs for flexible data is to apply a gate-based decision framework. This determines whether JSONB or normalized relational designs best balance flexibility with queryability and performance.