snapshot-management

Manage PostgreSQL MVCC snapshot stacks and tuple visibility logic.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/matejformanek/postgres-claude --skill snapshot-management
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: snapshot-management
Source: https://github.com/matejformanek/postgres-claude/tree/main/.claude/skills/snapshot-management
Command: npx skills add https://github.com/matejformanek/postgres-claude --skill snapshot-management

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill resolves complex debugging challenges related to PostgreSQL row visibility, snapshot leaks, and isolation-level behavior, preventing common errors in database internals development.

Core Features & Use Cases

  • Visibility Analysis: Debugs why rows appear visible or invisible by analyzing HeapTupleSatisfiesMVCC logic and snapshot states.
  • Lifecycle Management: Provides authoritative guidance on managing ActiveSnapshot stacks and RegisteredSnapshots to prevent memory leaks and vacuum issues.
  • Use Case: When investigating why a long-running transaction is preventing vacuum from cleaning up dead tuples, use this skill to inspect the snapshot registration and xmin horizon.

Quick Start

Use the snapshot-management skill to analyze the current transaction snapshot and identify potential visibility leaks in the active session.

Frequently Asked Questions about snapshot-management

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

FAQPage Schema
Why does PostgreSQL vacuum fail to clean up dead tuples during a long-running transaction?

PostgreSQL vacuum fails to clean dead tuples when long-running transactions hold active snapshots with an xmin horizon preventing removal. Analyzing snapshot registration reveals the visibility leak blocking cleanup.

How does PostgreSQL MVCC visibility determine if a row is visible to a transaction?

PostgreSQL MVCC visibility determines row visibility by evaluating HeapTupleSatisfiesMVCC logic against the current snapshot state. This mechanism checks tuple xmin and xmax transaction statuses to decide if rows appear visible or invisible to the active session.

How do I debug PostgreSQL isolation level behaviors and snapshot leaks?

Debug PostgreSQL isolation level behaviors and snapshot leaks by analyzing the ActiveSnapshot stack and RegisteredSnapshots. Correct transaction state handling prevents memory leaks and ensures proper visibility logic across different isolation configurations.

What is the best way to manage PostgreSQL ActiveSnapshot stacks for parallel worker exports?

Manage PostgreSQL ActiveSnapshot stacks for parallel worker exports by maintaining correct snapshot registration and lifecycle states. Proper snapshot infrastructure ensures parallel workers receive consistent transaction visibility during logical decoding historic snapshot operations.

When do I need to inspect PostgreSQL snapshot registration to prevent memory leaks?

Inspect PostgreSQL snapshot registration to prevent memory leaks when long-running transactions delay tuple cleanup or when debugging unexpected visibility behaviors. Managing RegisteredSnapshots ensures proper lifecycle handling and prevents vacuum issues.

Does logical decoding in PostgreSQL require historic snapshot management?

Logical decoding in PostgreSQL requires historic snapshot management to maintain correct transaction state handling. Proper integration with snapshot infrastructure ensures consistent row visibility for logical replication operations.