index
GiST
Extensible search tree supports operator-class-specific searches, such as range overlap. Target: PostgreSQL 17. Use a disposable database; plan selection is not guaranteed.
Formal Syntax & Structure
sql syntaxsql
CREATE INDEX ix ON slots USING gist (span)Working Example
Example Snippetsql
CREATE TABLE slots(id int, span int4range); INSERT INTO slots VALUES (1,'[1,5)'),(2,'[8,10)');CREATE INDEX ix ON slots USING gist (span);SELECT id FROM slots WHERE span && int4range(3,4);