lower_quantile
lower_quantile
lower_quantile : Lower quantile aggregate function
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4620 | lower_quantile | lower_quantile | 1.0.3 | FUNC | BSD 2-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-- | No | Yes | No | Yes | no | no |
| Relationships | |
|---|---|
| See Also | quantile topn ddsketch omnisketch count_distinct first_last_agg |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.3 | 18 17 16 15 14 | lower_quantile | - |
| RPM | PIGSTY | 1.0.3 | 18 17 16 15 14 | lower_quantile_$v | - |
| DEB | PIGSTY | 1.0.3 | 18 17 16 15 14 | postgresql-$v-lower-quantile | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
el8.aarch64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
el9.x86_64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
el9.aarch64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
el10.x86_64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
el10.aarch64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
d12.x86_64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
d12.aarch64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
d13.x86_64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
d13.aarch64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
u22.x86_64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
u22.aarch64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
u24.x86_64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
u24.aarch64 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 | PIGSTY 1.0.3 |
Source
pig build pkg lower_quantile; # build rpm/debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install lower_quantile; # install via package name, for the active PG version
pig install lower_quantile -v 18; # install for PG 18
pig install lower_quantile -v 17; # install for PG 17
pig install lower_quantile -v 16; # install for PG 16
pig install lower_quantile -v 15; # install for PG 15
pig install lower_quantile -v 14; # install for PG 14Create this extension with:
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.
Last updated on