Re: INDEX suggestion needed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>, Thomas Beutin <tyrone(at)laokoon(dot)IN-Berlin(dot)DE>, pgsql-general(at)postgresql(dot)org
Subject: Re: INDEX suggestion needed
Date: 2002-12-13 18:23:50
Message-ID: 6412.1039803830@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Manfred Koizar <mkoi-pg(at)aon(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vivek Khera 2002-12-13 18:40:19 Re: Urgent need of (paid) PostgreSQL support in New
Previous Message Tom Lane 2002-12-13 18:16:28 Re: \dD Bug??