All Products
Search
Document Center

PolarDB:ST_MD5Sum

Last Updated:Mar 28, 2026

Returns the MD5 hash of a raster object.

Syntax

text ST_MD5Sum(raster raster_obj)

Parameters

ParameterDescription
raster_objThe raster object to query.

Description

ST_MD5Sum looks up the MD5 hash in the raster object's metadata and returns it directly if found. If the MD5 hash cannot be found in the metadata, the function returns NULL. The function then calculates the MD5 hash based on the raster object's path in Object Storage Service (OSS).

By default, MD5 hashes are not computed or stored when raster objects are written to OSS (ganos.raster.calculate_md5 = false).

To control this behavior, configure the following parameters:

ParameterTypeDefaultDescription
ganos.raster.calculate_md5booleanfalseWhether to compute and store the MD5 hash in metadata when a raster object is written to OSS.
ganos.raster.md5sum_chunk_sizeinteger10The amount of data buffered per read when computing the MD5 hash, in MB. Valid values: 1–256.

Example: enable MD5 computation at write time

SET ganos.raster.calculate_md5 = true;
SET ganos.raster.md5sum_chunk_size = 20;

Example

SELECT ST_MD5SUM(rast)
FROM raster_table
WHERE id = 1;

Result:

              st_md5sum
-----------------------------------
 21f41fd983d3139c75b04bff2b7bf5c9