STS_SubtrackBuild function
The STS_SubtrackBuild function indexes spatiotemporal data for the specified subtrack table.
Syntax
STS_SubtrackBuild(
subtrack_name VARCHAR(128),
flags INTEGER DEFAULT 1)
returns BIGINT
- subtrack_name
- The name of the subtrack table. Must exist.
- flags
- The scope of the indexing:
Usage
Run the STS_SubtrackBuild function to populate the specified subtrack table. You must have created the subtrack table by running the STS_SubtrackCreate function. The indexing time range is set by the values of the ts_data_first_timestamp and ts_data_lag_to_current parameters, as set in the STS_SubtrackCreate function, or as reset by the STS_SubtrackAlterFirstTimeStamp and STS_SubtrackAlterLagToCurrent functions.
If you set the flags parameter to 1, indexing begins after the end time of the latest entry in the subtrack table. If the subtrack table is empty, indexing begins from the value of the ts_data_first_timestamp parameter and continues until the time that is specified by the ts_data_lag_to_current parameter.
If you set the flags parameter to 2, any existing data in the subtrack table is deleted, and then the every time series element is indexed from the value of the ts_data_first_timestamp parameter until the time that is specified by the ts_data_lag_to_current parameter. Rebuilding the subtrack table can be useful if you need to remove or update existing data or add data that is earlier than the latest time stamp.
Returns
An integer = The number of time series values processed.
An exception = An error.
Example: Rebuild the whole subtrack table
The following statement rebuilds the whole ts_vehicle_subtrack subtrack table:
BEGIN WORK;
EXECUTE FUNCTION STS_SubtrackBuild('ts_vehicle_subtrack', 2);
COMMIT WORK;
Example: Update the subtrack table
The following statement updates the subtrack table with trajectories for new data:
BEGIN WORK;
EXECUTE FUNCTION STS_SubtrackBuild('ts_vehicle_subtrack', 1);
COMMIT WORK;