GiST (Generalized Search Tree) is a flexible indexing framework for multi-dimensional data. In Ganos, create a GiST index on a trajectory column to accelerate spatial and temporal queries run by operators and the functions ST_ndIntersect, ST_ndDWithin, ST_ndContains, and ST_ndWithin.
Syntax
CREATE INDEX [index_name] ON table_name USING GIST(traj_col [operator_family]);| Parameter | Required | Description |
|---|---|---|
index_name | No | Name of the index |
table_name | Yes | Name of the table that contains the trajectory column |
traj_col | Yes | Name of the trajectory column |
operator_family | No | Operator family used to build the index. Default: trajgist_ops_multi. Configure via the ganos.trajectory.index_split_config parameter |
Supported operator families
Each operator family determines which axes are indexed and which query types the index can accelerate.
| Operator family | Indexed axes | Supported queries |
|---|---|---|
trajgist_ops_z | z | Queries on z only |
trajgist_ops_t | t | Queries on t only |
trajgist_ops_2d | x, y | Queries on x and y only |
trajgist_ops_2dt | x, y, t | Queries on x and y only; queries on t only; queries on x, y, and t |
trajgist_ops_3d | x, y, z | Queries on x and y only; queries on z only; queries on x, y, and z |
trajgist_ops_3dt | x, y, z, t | All query types supported by the preceding five operator families |
trajgist_ops_multi | Multiple bounding boxes | All query types; requires more time and storage to build the index |
Choose an operator family based on the axes your queries use. For example, if your queries filter on both space (x, y) and time (t), use trajgist_ops_2dt. Use trajgist_ops_multi (the default) when you need broad coverage across all query types and can accept the higher build cost.
Examples
Create an index on the t axis:
CREATE INDEX ON table_name USING GIST(traj_col trajgist_ops_t);Create an index on the x and y axes:
CREATE INDEX ON table_name USING GIST(traj_col trajgist_ops_2d);Create an index on the x, y, and t axes:
CREATE INDEX ON table_name USING GIST(traj_col trajgist_ops_2dt);