Re: why does count take so long?

From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <gsstark(at)mit(dot)edu>, pgsql-general(at)postgresql(dot)org
Subject: Re: why does count take so long?
Date: 2003-09-09 16:54:35
Message-ID: 3F5E05CB.2090805@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is improving count(*) <a lot if possible> on one of the TODO lists?

Jean-Luc Lachance wrote:

>How about keeping counts of inserts, deletes and updates per table per
>transaction as part of the live statistics?
>
>
>
>Tom Lane wrote:
>
>
>>I said:
>>
>>
>>>Greg Stark <gsstark(at)mit(dot)edu> writes:
>>>
>>>
>>>>Things like count(*) could use int4 until it overflows though.
>>>>
>>>>
>>>I don't see a reasonable way for an aggregate to change state datatype
>>>on the fly; otherwise this would be a great solution.
>>>
>>>
>>On the other hand, the cost is imposed by the generic aggregate
>>definition that says the aggregate state transition function is an
>>ordinary function. This is fine for user-defined aggregates, but there
>>is no law that says that all the built-in aggregates must use that same
>>API. We could probably invent some API that allows COUNT(*) to keep its
>>running count someplace where it needn't be re-palloc'd on every cycle.
>>Something to think about for 7.5 (too late for 7.4 I fear).
>>
>> regards, tom lane
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 2: you can get off all lists at once with the unregister command
>> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>>
>>
>
>---------------------------(end of broadcast)---------------------------
>TIP 8: explain analyze is your friend
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message scott.marlowe 2003-09-09 16:59:49 Re: why does count take so long?
Previous Message Edwin Quijada 2003-09-09 16:54:27 Picture with Postgres and Delphi