Re: BUG #14011: select count(distinct column) does not utilizes indices to improve performance

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gtakahashi(at)palantir(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14011: select count(distinct column) does not utilizes indices to improve performance
Date: 2016-03-10 04:50:04
Message-ID: 7830.1457585404@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

gtakahashi(at)palantir(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2016-03-10 06:24:06 Re: BUG #13755: pgwin32_is_service not checking if SECURITY_SERVICE_SID is disabled
Previous Message gtakahashi 2016-03-10 04:33:27 BUG #14011: select count(distinct column) does not utilizes indices to improve performance