lock_check
Analyze PostgreSQL DDL statements to determine lock levels, full table rewrites, and estimated duration. Get warnings for high-impact locks and actionable recommendations before running on production.
Instructions
Static analysis of a SQL statement to determine the PostgreSQL lock level it will require, whether it forces a full table rewrite, and an estimated duration based on target table size. Returns warnings for ACCESS EXCLUSIVE locks on busy production tables and concrete recommendations (e.g., use CREATE INDEX CONCURRENTLY, NOT VALID + VALIDATE CONSTRAINT, etc). Use BEFORE running DDL on production. Knows lock semantics for ALTER TABLE variants, CREATE/DROP INDEX (concurrent vs not), VACUUM, CLUSTER, REFRESH MATERIALIZED VIEW, and more.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | SQL DDL statement to analyze. | |
| estimate_duration | No | Look up target table size to estimate duration. | |
| server | No | ||
| database | No | ||
| schema | No |