Exports a trajectory to external storage.
This function is expected to be deprecated in a later version. Use Cold data tiered storage for a better experience.
Syntax
trajectory ST_ExportTo(trajectory traj, text path, text config);
Parameters
|
Parameter |
Description |
|
traj |
The trajectory object. |
|
path |
The external storage string. Currently, only OSS folders are supported. The format is |
|
config |
A JSON string. The format is as follows:
|
Description
This function stores the time, space, event, and attribute information of a trajectory to a folder in OSS.
An endpoint is a regional node of OSS. To ensure the performance of data import, make sure that the PolarDB for PostgreSQL cluster and the OSS bucket are in the same region. For more information, see OSS endpoint.
The binary data of a trajectory is appended to .gtf files in the specified folder. The file name format is <file sequence numbers in descending order>_0_1.gtf. Each file is about 2 GB in size, and the size is controlled by the ganos.trajectory.ext_storage_block_size parameter.
If .gtf files already exist in the corresponding folder, the data is appended to the corresponding .gtf files. For a trajectory that is already externally stored, if it is detected that the trajectory is already stored in the corresponding folder, the trajectory is not stored again. Otherwise, the trajectory is read and stored again.
Deleting or modifying data in the database does not update the corresponding external storage files. Changes to the external files may make the data in the database unavailable.
Choice of compression algorithm: zlib takes up the least storage space, and zstd has the best overall efficiency.
Example
UPDATE trajs
SET traj = ST_exportTo(traj, 'OSS://<access key>:<access secret>@oss-cn-beijing-internal/<bucket>/<directory>', '{}');