There are several aggregating functions that are executed in a special way.
The first group of such aggregating functions is called ordered-set aggregates. They take into account not just the values of the argument expressions, but also their order. They are related to statistics and calculate percentile values.
A percentile is the value of a group of numbers when the given percentage of other values is less than the percentile. For example, if a value is at the 95th percentile, this means that it's greater than 95 percent of the other values. In PostgreSQL, you can calculate a continuous or discrete percentile using the percentile_cont and percentile_disc functions, respectively.
A discrete percentile is one of the ...