count_distinct
An alternative to COUNT(DISTINCT …) aggregate, usable with HashAggregate
Repository
tvondra/count_distinct
https://github.com/tvondra/count_distinct
Source
count_distinct-3.0.2.tar.gz
count_distinct-3.0.2.tar.gz
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
count_distinct | 3.0.2 | FUNC | BSD-2-Clause | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4630 | count_distinct | No | Yes | No | Yes | No | Yes | - |
no pg14 on el8/9 pgdg
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | MIXED | 3.0.2 | 1817161514 | count_distinct | - |
| RPM | PIGSTY | 3.0.2 | 1817161514 | count_distinct_$v | - |
| DEB | PIGSTY | 3.0.2 | 1817161514 | postgresql-$v-count-distinct | - |
Build
You can build the RPM / DEB packages for count_distinct using pig build:
Install
You can install count_distinct directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Install
pig
dnf
apt
Create Extension:
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 |
Examples
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)