Re: Slow count(*) again...

From: Scott Carey <scott(at)richrelevance(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jesper Krogh <jesper(at)krogh(dot)cc>, Mladen Gogala <mladen(dot)gogala(at)vmsinfo(dot)com>, "david(at)lang(dot)hm" <david(at)lang(dot)hm>, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>, Vitalii Tymchyshyn <tivv00(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Slow count(*) again...
Date: 2010-10-21 04:47:24
Message-ID: B54FDA83-1DBD-4313-AF44-EF53F3EB85D4@richrelevance.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance


On Oct 12, 2010, at 11:58 AM, Tom Lane wrote:

> Jesper Krogh <jesper(at)krogh(dot)cc> writes:
>> On 2010-10-12 19:07, Tom Lane wrote:
>>> Anyway, if anyone is hot to make COUNT(*) faster, that's where to look.
>
>> Just having 32 bytes bytes of "payload" would more or less double
>> you time to count if I read you test results correctly?. .. and in the
>> situation where diskaccess would be needed .. way more.
>
>> Dividing by pg_relation_size by the amout of tuples in our production
>> system I end up having no avg tuple size less than 100bytes.
>
> Well, yeah. I deliberately tested with a very narrow table so as to
> stress the per-row CPU costs as much as possible. With any wider table
> you're just going to be I/O bound.

On a wimpy disk, I/O bound for sure. But my disks go 1000MB/sec. No query can go fast enough for them. The best I've gotten is 800MB/sec, on a wide row (average 800 bytes). Most tables go 300MB/sec or so. And with 72GB of RAM, many scans are in-memory anyway.

A single SSD with supercapacitor will go about 500MB/sec by itself next spring. I will easily be able to build a system with 2GB/sec I/O for under $10k.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2010-10-21 04:54:26 Re: pg_hba.conf host name wildcard support
Previous Message Bruce Momjian 2010-10-21 04:07:22 Re: Slow count(*) again...

Browse pgsql-performance by date

  From Date Subject
Next Message AI Rumman 2010-10-21 05:25:06 Index scan is not working, why??
Previous Message Scott Marlowe 2010-10-21 04:45:08 Re: BBU Cache vs. spindles