This topic describes TrajGiST indexing, which is an extension to GiST indexing. You can create a TrajGiST index on a column that stores trajectory data.

Background information

TrajGiST performs better than GiST in the following ways:

  • TrajGiST provides a better method to estimate the overheads of indexes. If more than one index is created, TrajGiST can select an index in a more efficient manner than GiST.
  • TrajGiST supports upward compatibility of indexes. If an accurate result cannot be obtained because the index does not provide sufficient information, you can still obtain a coarse-grained result by using an index-based scan. For example, you have created an index only on the t axis, but you want to call the ST_{2DT}Intersects function. In this case, you can filter out the trajectories that do not fall within a specified time range based on the index on the t axis.

Syntax

CREATE INDEX [index_name] on table_name USING TRAJGIST(traj_col [operator_family]);
  • index_name: the name of the index. This parameter is optional.
  • table_name: the name of the table to which the column belongs.
  • traj_col: the name of the column.
  • operator_family: the operator family that is used to create the index. Default value: trajgist_ops_multi. You can use the ganos.trajectory.index_split_config parameter to specify the operator family. This parameter is optional.
Note The created index helps accelerate queries that are run by operators and the following functions: ST_ndIntersect, ST_ndDWithin, ST_ndContains, and ST_ndWithin.

Supported operator families

The following table describes the operator families that are supported by TrajGisT.

Operator family Description
trajgist_ops_z Creates an index on the z axis. This type of index supports queries that cover only the z axis.
trajgist_ops_t Creates an index on the t axis. This type of index supports queries that cover only the t axis.
trajgist_ops_2d Creates an index on the x and y axes. This type of index supports queries that cover only the x and y axes.
trajgist_ops_2dt Creates an index on the x, y, and t axes. This type of index supports queries that cover the x, y, and t axes.
trajgist_ops_3d Creates an index on the x, y, and z axes. This type of index supports queries that cover the x, y, and z axes.
trajgist_ops_3dt Creates an index on the x, y, z, and t axes. This type of index supports all queries that are supported by the preceding five operator families.
trajgist_ops_multi Creates an index on multiple bounding boxes to accelerate queries. However, the system requires more time and storage to create the index.
Note TrajGiST allows you to create an index on a single column. TrajGiST does not allow you to create an index on multiple columns when some of the columns store other types of data than trajectory data.