All Products
Search
Document Center

ApsaraDB RDS:GiST indexing

Last Updated:Mar 28, 2026

GiST (Generalized Search Tree) indexes accelerate spatial queries on trajectory data. You can create a GiST index on a column that stores trajectory data.

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 containing the trajectory column.
traj_colYesName of the trajectory column to index.
operator_familyNoOperator family that determines which axes and query types the index supports. Default: trajgist_ops_multi. To customize this, use the ganos.trajectory.index_split_config parameter.
Note

The GiST index accelerates queries that use the following functions: ST_ndIntersect, ST_ndDWithin, ST_ndContains, and ST_ndWithin.

Choose an operator family

Each operator family indexes a specific combination of axes (x, y, z, t) and supports the corresponding query types. Choose the operator family that matches the axes your queries filter on.

Operator familyIndexed axesSupported query types
trajgist_ops_zzz-axis queries
trajgist_ops_ttt-axis queries
trajgist_ops_2dx, yx/y-axis queries
trajgist_ops_2dtx, y, tx/y-only, t-only, and x/y/t queries
trajgist_ops_3dx, y, zx/y-only, z-only, and x/y/z queries
trajgist_ops_3dtx, y, z, tAll query types supported by the five families above
trajgist_ops_multiMultiple bounding boxesAccelerates queries; requires more time and storage to create than the other families

Choosing an operator family:

  • Query only the t axis: trajgist_ops_t

  • Query x/y and t together: trajgist_ops_2dt (one index instead of two separate indexes)

  • Query all axes: trajgist_ops_3dt

  • Need maximum query coverage and can accommodate higher storage and index creation time: trajgist_ops_multi

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);

What's next