In most cases, a trajectory contains a large amount of data. In some scenarios, new trajectory points are constantly added to the trajectory. To reduce storage costs, you can store cold data that is less queried or updated in Object Storage Service (OSS) buckets.

You can execute the following statement to import trajectory data to an OSS bucket:
UPDATE trajectory_table
SET traj =  ST_exportTo(
                traj, 
                'OSS://<access key>:<access secret>@oss-cn-beijing-internal.aliyuncs.com/<bucket>/<directory>',
                '{"compress":"zstd"}'
        );
Parameter Description
'OSS://<access key>:<access secret>@oss-cn-beijing-internal.aliyuncs.com/<bucket>/<directory>' The URL of the OSS bucket to which you want to store trajectory data. For more information, see OSS domain names.
  • <access key>:< access secret>: the AccessKey pair to access the OSS bucket.
  • oss-cn-beijing-internal.aliyuncs.com: the OSS endpoint.
  • <bucket>/<directory>: the directory of the file to store trajectory data in the OSS bucket.
"compress":"zstd" The method that is used to compress data. For more information about compression methods, see ST_ExportTo.

After the data is imported into the OSS bucket, you can use the same statement to query the data. However, the query efficiency decreases. If you need to create an index, you must create an index before you import the data to the OSS bucket.