This function is used to query the percentiles of the specified bands of a raster.

Syntax

float8 ST_Percentile(raster raster_obj,
                     integer band,
                     integer percentage)

Parameters

ParameterDescription
raster_objThe raster that you want to query.
bandThe IDs of the bands. Valid band IDs start from 0.
percentageThe percentiles of the raster. For more information, see ST_BuildPercentiles or ST_ComputeStatistics.

Examples

SELECT st_percentile(rast_obj, 0, 10)
FROM raster_table
WHERE id = 1;

--------------------
29.7
You can use the ST_Percentile function to obtain the same result as the result that you can obtain by using the ST_Quantile function.
SELECT st_percentile(rast_obj, 0, 25), st_percentile(rast_obj, 0, 50)
FROM raster_table
WHERE id = 1;