Re: Query take a long time and use no index

From: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>
To: basti <mailinglist(at)unix-solution(dot)de>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Query take a long time and use no index
Date: 2023-07-17 11:21:36
Message-ID: 7599651d-7269-ec5b-b968-46795a76c375@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/17/23 13:20, Tomas Vondra wrote:
> ...
>
> It's always going to be slow with the COUNT(DISTINCT), I'm afraid.
>
> Not sure how much you can modify the query / database, and how accurate
> results you need. If you're OK with estimates, you can try postgres-hll
> extension [2] which estimates count(distinct). For exact reaults, I
> wrote count_distinct extension [2] that uses hashtable. Might be worth a
> try, I guess.
>

Damn, I forgot to add the links:

[1] https://github.com/citusdata/postgresql-hll

[2] https://github.com/tvondra/count_distinct

regards

--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2023-07-17 13:03:36 Re: Query take a long time and use no index
Previous Message Tomas Vondra 2023-07-17 11:20:13 Re: Query take a long time and use no index