comprehensive documentation repository

MySQL 5.5 Reference Manual

11.17.6.1. Creating Spatial Indexes

For MyISAM tables, MySQL can create
spatial indexes using syntax similar to that for creating
regular indexes, but extended with the
SPATIAL keyword. Currently, columns in
spatial indexes must be declared NOT NULL.
The following examples demonstrate how to create spatial
indexes:

For MyISAM tables, SPATIAL
INDEX creates an R-tree index. For storage engines
that support nonspatial indexing of spatial columns, the engine
creates a B-tree index. A B-tree index on spatial values will be
useful for exact-value lookups, but not for range scans.

Example: Suppose that a table geom contains
more than 32,000 geometries, which are stored in the column
g of type GEOMETRY. The
table also has an AUTO_INCREMENT column
fid for storing object ID values.