max_val()

  1. max_val(digest TDigest) RETURNS DOUBLE PRECISION

Get the maximum value from a t-digest (does not work with percentile_agg or uddsketch based estimators). This is provided in order to save space when both a maximum and a percentile estimate are required as part of continuous aggregates. You can simply compute a single percentile estimator and do not need to specify a separate max aggregate, just extract the max_val from the percentile estimator.

Required Arguments

NameTypeDescription
digestTDigestThe digest to extract the max value from.

Returns

ColumnTypeDescription
max_valDOUBLE PRECISIONThe maximum value entered into the t-digest.

Sample Usage

  1. SELECT max_val(tdigest(100, data))
  2. FROM generate_series(1, 100) data;
  1. max_val
  2. ---------
  3. 100