MP051WARNINGFree

require-spatial-index

What It Detects

Spatial/geometry columns without a GIST or SP-GIST index will cause full sequential scans on spatial queries.

Why It's Dangerous

PostGIS geometry and geography columns need a GIST or SP-GIST index for efficient spatial queries (ST_Contains, ST_DWithin, etc.). Without one, every spatial query triggers a full sequential scan.

Bad Example

CREATE TABLE locations (
  id bigint PRIMARY KEY,
  geom geometry NOT NULL
);
-- No spatial index!

Good Example

CREATE TABLE locations (
  id bigint PRIMARY KEY,
  geom geometry NOT NULL
);
CREATE INDEX CONCURRENTLY idx_locations_geom
  ON locations USING GIST (geom);

Configuration

Disable this rule:

# .migrationpilotrc.yml
rules:
  MP051: false

Or change its severity:

# .migrationpilotrc.yml
rules:
  MP051:
    severity: warning