From: Greg Stark <gsstark@mit.edu>
To: Mark Kirkwood <markir@paradise.net.nz>
Cc: Luke Lonergan <llonergan@greenplum.com>
Cc: stange@rentec.com, Greg Stark <gsstark@mit.edu>
Cc: Dave Cramer <pg@fastcrypt.com>
Cc: Joshua Marsh <icub3d@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Hardware/OS recommendations for large databases (
Date: 24 Nov 2005 11:00:25 -0500
Message-ID: <87d5kqkpd2.fsf@stark.xeocode.com> (raw)
In-Reply-To: <438583C8.4050809@paradise.net.nz>
References: <BFAAB702.1460D%llonergan@greenplum.com>
<438583C8.4050809@paradise.net.nz>
Mark Kirkwood <markir@paradise.net.nz> writes:
> Yeah - it's pretty clear that the count aggregate is fairly expensive wrt cpu -
> However, I am not sure if all agg nodes suffer this way (guess we could try a
> trivial aggregate that does nothing for all tuples bar the last and just
> reports the final value it sees).
As you mention count(*) and count(1) are the same thing.
Last I heard the reason count(*) was so expensive was because its state
variable was a bigint. That means it doesn't fit in a Datum and has to be
alloced and stored as a pointer. And because of the Aggregate API that means
it has to be allocated and freed for every tuple processed.
There was some talk of having a special case API for count(*) and maybe
sum(...) to avoid having to do this.
There was also some talk of making Datum 8 bytes wide on platforms where that
was natural (I guess AMD64, Sparc64, Alpha, Itanic).
Afaik none of these items have happened but I don't know for sure.
--
greg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: gsstark@mit.edu, markir@paradise.net.nz, llonergan@greenplum.com, pg@fastcrypt.com, icub3d@gmail.com
Subject: Re: Hardware/OS recommendations for large databases (
In-Reply-To: <87d5kqkpd2.fsf@stark.xeocode.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox