count_distinct
An alternative to COUNT(DISTINCT …) aggregate, usable with HashAggregate
count_distinct : An alternative to COUNT(DISTINCT …) aggregate, usable with HashAggregate
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4630 | count_distinct | count_distinct | 3.0.2 |
FUNC | BSD-2-Clause | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | ddsketch tdigest topn omnisketch datasketches hll intagg intarray |
no pg14 on el8/9 pgdg
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | MIXED | 3.0.2 |
18 17 16 15 14 | count_distinct |
- |
| RPM | PIGSTY | 3.0.2 |
18 17 16 15 14 | count_distinct_$v |
- |
| DEB | PIGSTY | 3.0.2 |
18 17 16 15 14 | postgresql-$v-count-distinct |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| el8.aarch64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| el9.x86_64 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 |
| el9.aarch64 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 |
| el10.x86_64 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 |
| el10.aarch64 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 | PGDG 3.0.2 |
| d12.x86_64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| d12.aarch64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| d13.x86_64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| d13.aarch64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| u22.x86_64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| u22.aarch64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| u24.x86_64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| u24.aarch64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| u26.x86_64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
| u26.aarch64 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 | PIGSTY 3.0.2 |
Source
github.com/tvondra/count_distinct
count_distinct-3.0.2.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Create this extension with:
Usage
count_distinct: alternative to COUNT(DISTINCT …) with better performance
Provides an alternative to COUNT(DISTINCT ...) that avoids sorting and supports parallel aggregation.
Functions
| Function | Description |
|---|---|
count_distinct(value anyelement) |
Count distinct values (alternative to COUNT(DISTINCT ...)) |
array_agg_distinct(value anyelement) |
Aggregate distinct values into an array |
count_distinct_elements(value anyarray) |
Count distinct elements within input arrays |
array_agg_distinct_elements(value anyarray) |
Aggregate distinct elements from input arrays |