Re: INDEX suggestion needed - Mailing list pgsql-general

From Tom Lane
Subject Re: INDEX suggestion needed
Date
Msg-id 6412.1039803830@sss.pgh.pa.us
Whole thread Raw
In response to Re: INDEX suggestion needed  (Manfred Koizar <mkoi-pg@aon.at>)
List pgsql-general
Manfred Koizar <mkoi-pg@aon.at> writes:
> COUNT is cheap.  But COUNT(DISTINCT something) is not trivial, it has
> to keep a list of all values it has already counted.  I didn't look at
> the implementation.  Do we have O(n^2) cost here?

No, more like O(n ln n) --- it's a sort/uniq implementation.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: \dD Bug??
Next
From: Vivek Khera
Date:
Subject: Re: Urgent need of (paid) PostgreSQL support in New