All Products
Search
Document Center

PolarDB:ST_subTrajectory

Last Updated:Mar 28, 2026

Returns the sub-trajectory of a trajectory object within a specified time range.

Syntax

trajectory ST_subTrajectory(trajectory traj, timestamp starttime, timestamp endtime);
trajectory ST_subTrajectory(trajectory traj, tsrange range);

Parameters

ParameterTypeDescription
trajtrajectoryThe source trajectory object.
starttimetimestampThe start of the time range.
endtimetimestampThe end of the time range.
rangetsrangeThe time range, expressed as a PostgreSQL tsrange value.

Examples

Extract the sub-trajectory recorded between 02:45:30 and 03:00:00 on January 11, 2010:

Select ST_subTrajectory(traj, '2010-1-11 02:45:30', '2010-1-11 03:00:00') FROM traj_table;