pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Kirkwood <markir@paradise.net.nz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Stark <gsstark@mit.edu>
Cc: Luke Lonergan <llonergan@greenplum.com>
Cc: stange@rentec.com, 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: Fri, 25 Nov 2005 11:07:50 +1300
Message-ID: <438639B6.5090902@paradise.net.nz> (raw)
In-Reply-To: <14286.1132849528@sss.pgh.pa.us>
References: <BFAAB702.1460D%llonergan@greenplum.com>
	<438583C8.4050809@paradise.net.nz>
	<87d5kqkpd2.fsf@stark.xeocode.com>
	<14286.1132849528@sss.pgh.pa.us>

Tom Lane wrote:
> Greg Stark <gsstark@mit.edu> writes:
> 
>>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's a hack in 8.1 to avoid the palloc overhead (courtesy of Neil
> Conway IIRC).
>

It certainly makes quite a difference as I measure it:

doing select(1) from a 181000 page table (completely uncached) on my PIII:

8.0 : 32 s
8.1 : 25 s

Note that the 'fastcount()' function takes 21 s in both cases - so all 
the improvement seems to be from the count overhead reduction.

Cheers

Mark










view thread (173+ messages)  latest in thread

Message-ID: <438639B6.5090902@paradise.net.nz>
Permalink:  ../438639B6.5090902@paradise.net.nz/
Also on:    postgresql.org/message-id/438639B6.5090902@paradise.net.nz

 · 

reply

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: markir@paradise.net.nz, tgl@sss.pgh.pa.us, gsstark@mit.edu, llonergan@greenplum.com, pg@fastcrypt.com, icub3d@gmail.com
  Subject: Re: Hardware/OS recommendations for large databases (
  In-Reply-To: <438639B6.5090902@paradise.net.nz>

* 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