index

SP-GiST

Space-partitioned search infrastructure supports suitable operator classes, including points; not a universal replacement for GiST. Target: PostgreSQL 17. Use a disposable database; plan selection is not guaranteed.

Formal Syntax & Structure

sql syntaxsql
CREATE INDEX ix ON places USING spgist (pos)

Working Example

Example Snippetsql
CREATE TABLE places(id int, pos point); INSERT INTO places VALUES (1,point(1,1)),(2,point(9,9));CREATE INDEX ix ON places USING spgist (pos);SELECT id FROM places WHERE pos <@ box(point(0,0),point(2,2));
SQL Reference