7. Create an index

7.1. Spherical index

pgSphere uses GiST to create spherical indices. An index speeds up the execution time of operators <@, @, &&, #, =, and !=. You can create an index with the following spherical data types:

Example 50. Simple index of spherical points


CREATE TABLE test (
  pos spoint NOT NULL
);
-- Put in data now
CREATE INDEX test_pos_idx USING GIST ON test (pos);
VACUUM ANALYZE test;