index
Spatial
PostGIS geometry indexes support spatial filtering; index-aware predicates may narrow candidates before exact checks. Extension version is not pinned or tested. Target: PostgreSQL 17 + PostGIS. Use a disposable database; plan selection is not guaranteed.
Formal Syntax & Structure
sql syntaxsql
CREATE INDEX ix ON places USING gist (geom)Working Example
Example Snippetsql
CREATE EXTENSION IF NOT EXISTS postgis; CREATE TABLE places(id int, geom geometry(Point,4326)); INSERT INTO places VALUES (1,ST_SetSRID(ST_MakePoint(1,1),4326)),(2,ST_SetSRID(ST_MakePoint(9,9),4326));CREATE INDEX ix ON places USING gist (geom);SELECT id FROM places WHERE ST_Intersects(geom,ST_MakeEnvelope(0,0,2,2,4326));