GanosBase supports two index types for trajectory data. They differ in how they partition a trajectory into bounding boxes, which determines query filtering precision and storage cost.
Index types
| Index type | How it works | Storage | Filtering efficiency |
|---|---|---|---|
| Single bounding box | Represents each trajectory as one bounding box | Lower | Lower |
| Multi-bounding box | Splits a trajectory into multiple segments, each as a separate bounding box | Higher | Higher — spatial queries are at least twice as fast as queries without bounding box indexing |
Single bounding box
Available operator classes: trajgist_2d (two-dimensional), trajgist_3dt (three-dimensional and time).
Multi-bounding box
Operator class: multi.
Multi-bounding box indexing is not supported in some versions of GanosBase.
View the default index type
Run the following queries to check the current default index configuration:
-- List all trajectory-related operator classes and identify the default
SELECT * FROM pg_opclass WHERE opcname LIKE '%traj%' AND opcdefault = true;
-- Show the default split configuration (applies to trajgist_ops_multi)
SHOW ganos.trajectory.index_split_config;Create and manage indexes
Create a two-dimensional and time index
CREATE INDEX idx_2dt ON trajectory_table USING GiST(traj trajgist_2dt);Create a multi-bounding box index
Before creating a multi-bounding box index, configure how many bounding boxes represent each trajectory. The following example sets four bounding boxes:
SET ganos.trajectory.index_split_config = '{"cut_point.even_divide":4}';Then create the index:
CREATE INDEX idx_2dt ON trajectory_table USING GiST(traj multi);Drop an index
DROP INDEX idx_2dt;该文章对您有帮助吗?