SPATIAL INDEX
SPATIAL INDEX is a SQL statement in the Indexes category. Index for spatial/geometric columns (GIS data). Used with POINT, GEOMETRY types. The syntax is CREATE SPATIAL INDEX index_name ON table_name (column);. It returns spatial index. A typical example: CREATE TABLE locations (name VARCHAR(100), coords POINT NOT NULL SRID 4326); CREATE SPATIAL INDEX sp_coords ON locations (coords); -- Speeds up: SELECT * FROM locations WHERE ST_Distance_Sphere(coords, POINT(37.77, -122.42)) < 1000; A close relative is CREATE INDEX, which creates an index on one or more columns to speed up query performance. A close relative is DROP INDEX, which removes an existing index from a table. A close relative is COMPOSITE INDEX, which an index on multiple columns. Column order matters — queries use leftmost prefix. More about this category: Database indexes — CREATE INDEX, UNIQUE INDEX, COMPOSITE INDEX, DROP INDEX. Related Indexes entries: CREATE INDEX, DROP INDEX, COMPOSITE INDEX, EXPLAIN, FULLTEXT INDEX, INCLUDE INDEX (Covering Index), PARTIAL INDEX, INVISIBLE INDEX.