Good News re count(*) in 8.1

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Good News re count(*) in 8.1
Date: 2006-02-22 16:57:08
Message-ID: 43FC4384.EE98.0025.0@wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I hesitate to raise this issue again, but I've noticed something which I
thought might be worth mentioning. I've never thought the performance
of count(*) on a table was a significant issue, but I'm prepared to say
that -- for me, at least -- it is officially and totally a NON-issue.

We are replicating data from 72 source databases, each with the
official copy of a subset of the data, to four identical consolidated
databases, spread to separate locations, to serve our web site and other
organization-wide needs. Currently, two of these central databases are
running a commercial product and two are running PostgreSQL. There have
been several times that I have run a SELECT COUNT(*) on an entire table
on all central machines. On identical hardware, with identical data,
and equivalent query loads, the PostgreSQL databases have responded with
a count in 50% to 70% of the time of the commercial product, in spite of
the fact that the commercial product does a scan of a non-clustered
index while PostgreSQL scans the data pages.

The tables have had from a few million to 132 million rows. The
databases are about 415 GB each. The servers have 6 GB RAM each. We've
been running PostgreSQL 8.1, tuned and maintained based on advice from
the documentation and these lists.

I suspect that where people report significantly worse performance for
count(*) under PostgreSQL than some other product, it may sometimes be
the case that they have not properly tuned PostgreSQL, or paid attention
to maintenance issues regarding dead space in the tables.

My recent experience, for what it's worth.

-Kevin

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Luke Lonergan 2006-02-22 17:11:50 Re: Good News re count(*) in 8.1
Previous Message Vivek Khera 2006-02-22 16:32:33 Re: