lower_quantile
Lower quantile aggregate function
Repository
tvondra/lower_quantile
https://github.com/tvondra/lower_quantile
Source
lower_quantile-1.0.3.tar.gz
lower_quantile-1.0.3.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
lower_quantile | 1.0.3 | FUNC | BSD 2-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4620 | lower_quantile | No | Yes | No | Yes | No | No | - |
| Related | quantile topn ddsketch omnisketch count_distinct first_last_agg |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.3 | 1817161514 | lower_quantile | - |
| RPM | PIGSTY | 1.0.3 | 1817161514 | lower_quantile_$v | - |
| DEB | PIGSTY | 1.0.3 | 1817161514 | postgresql-$v-lower-quantile | - |
Build
You can build the RPM / DEB packages for lower_quantile using pig build:
pig build pkg lower_quantile # build RPM / DEB packages
Install
You can install lower_quantile directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install lower_quantile; # Install for current active PG version
pig ext install -y lower_quantile -v 18 # PG 18
pig ext install -y lower_quantile -v 17 # PG 17
pig ext install -y lower_quantile -v 16 # PG 16
pig ext install -y lower_quantile -v 15 # PG 15
pig ext install -y lower_quantile -v 14 # PG 14
dnf install -y lower_quantile_18 # PG 18
dnf install -y lower_quantile_17 # PG 17
dnf install -y lower_quantile_16 # PG 16
dnf install -y lower_quantile_15 # PG 15
dnf install -y lower_quantile_14 # PG 14
apt install -y postgresql-18-lower-quantile # PG 18
apt install -y postgresql-17-lower-quantile # PG 17
apt install -y postgresql-16-lower-quantile # PG 16
apt install -y postgresql-15-lower-quantile # PG 15
apt install -y postgresql-14-lower-quantile # PG 14
Create Extension:
CREATE EXTENSION lower_quantile;
Usage
Implements the “lower quantile” aggregate, which differs slightly from percentile_disc by returning the value whose rank in the sorted multiset is floor(1 + q*(n-1)).
CREATE EXTENSION lower_quantile;
Functions
| Function | Description |
|---|---|
lower_quantile(value, quantile float) | Compute the lower quantile for the given quantile value (0 to 1) |
Examples
-- Compute the lower-quantile median
SELECT lower_quantile(i, 0.5)
FROM generate_series(1, 1000) s(i);
-- Compute the 95th lower quantile
SELECT lower_quantile(i, 0.95)
FROM generate_series(1, 1000) s(i);
This definition is used by some papers (e.g., the DDSketch paper) to formulate accuracy guarantees.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.