Re: BUG #14011: select count(distinct column) does not utilizes indices to improve performance - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #14011: select count(distinct column) does not utilizes indices to improve performance
Date
Msg-id 7830.1457585404@sss.pgh.pa.us
Whole thread Raw
In response to BUG #14011: select count(distinct column) does not utilizes indices to improve performance  (gtakahashi@palantir.com)
List pgsql-bugs
gtakahashi@palantir.com writes:
> Doing a select count(distinct column) does not utilize indices

Nope, it does not.  Don't hold your breath waiting for that to change;
it might sometime, but nobody is working on it that I know of.

You'd have better luck with a "SELECT count(*) GROUP BY column"
type of query, I expect.  (Most likely that won't use an index either,
BTW, but it'll be smarter than count(distinct).)

            regards, tom lane

pgsql-bugs by date:

Previous
From: gtakahashi@palantir.com
Date:
Subject: BUG #14011: select count(distinct column) does not utilizes indices to improve performance
Next
From: Michael Paquier
Date:
Subject: Re: BUG #13755: pgwin32_is_service not checking if SECURITY_SERVICE_SID is disabled