Exports a trajectory object to a folder in an Object Storage Service (OSS) bucket.
This function is not supported in later versions. Use Cold data tiered storage instead.
Syntax
trajectory ST_ExportTo(trajectory traj, text path, text config);Parameters
| Parameter | Description |
|---|---|
traj | The trajectory object to export. |
path | The OSS folder path to store the exported data. Only OSS folders are supported. Format: 'OSS://<AccessKey ID>:<AccessKey secret>@<Endpoint>/<Bucket>/<Directory>'. The data is stored as a .gtf file in the specified folder. |
config | A JSON string that configures the export. Supported parameter: compress. Default value: none. Valid values: none, lz4, lzo, zstd, snappy, zlib. |
Usage notes
How data is stored
ST_ExportTo stores the time, space, event, and property data of a trajectory object to the specified OSS folder. The exported data is written to .gtf files with the naming format <sequence-number>_0_1.gtf. Files in the folder are sorted in descending order by sequence number. Each file is approximately 2 GB in size, controlled by the ganos.trajectory.ext_storage_block_size parameter.
Binary data is appended to an existing .gtf file if one already exists in the folder. If the system detects that the trajectory data is already stored in the specified folder, it skips the write. If the trajectory data is not in the folder, it reads the data and then writes it.
Data consistency
Deleting or updating database records does not update the corresponding OSS files. Conversely, modifying OSS files directly can make the database data unavailable.
Region requirements
Use the OSS endpoint for the region where your trajectory data is stored. Deploy your PolarDB cluster in the same region as the OSS bucket to ensure optimal export performance. For endpoint formats, see OSS domain names.
Compression
Choose a compression algorithm based on your requirements:
zlib: highest compression ratiozstd: best overall efficiencynone: no compression (default)
Examples
Export a trajectory object to an OSS bucket with no compression:
UPDATE trajs
SET traj = ST_exportTo(traj, 'OSS://<access key>:<access secret>@oss-cn-beijing-internal/<bucket>/<directory>', '{}');