All Products
Search
Document Center

PolarDB:GiST indexing

Last Updated:Mar 28, 2026

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]);
ParameterRequiredDescription
index_nameNoName of the index
table_nameYesName of the table that contains the trajectory column
traj_colYesName of the trajectory column
operator_familyNoOperator 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 familyIndexed axesSupported queries
trajgist_ops_zzQueries on z only
trajgist_ops_ttQueries on t only
trajgist_ops_2dx, yQueries on x and y only
trajgist_ops_2dtx, y, tQueries on x and y only; queries on t only; queries on x, y, and t
trajgist_ops_3dx, y, zQueries on x and y only; queries on z only; queries on x, y, and z
trajgist_ops_3dtx, y, z, tAll query types supported by the preceding five operator families
trajgist_ops_multiMultiple bounding boxesAll 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);