PGSQL PERFORMANCE 34 RE SEQSCAN RATHER THAN INDEX
From: frank@no-spam (Frank Wiles)
Subject: Re: Seqscan rather than Index
Date: Fri, 17 Dec 2004 17:02:29 -0600


On Fri, 17 Dec 2004 23:09:07 +0100
"Steinar H. Gunderson" <sgunderson@no-spam> wrote:

> On Fri, Dec 17, 2004 at 10:56:27PM +0100, Steinar H. Gunderson wrote:
> > I'm a bit unsure -- should counting ~3 million rows (no OIDs, PG > > 7.4, everything in cache, 32-byte rows) take ~3500ms on an Athlon 64
> > 2800+?
> > (I realize I was a bit unclear here. This is a completely separate > case, not related to the original poster -- I was just wondering if > what I'm seeing is normal or not.)

It depends more on your disk IO than the processor. Counting isn't processor intensive, but reading through the entire table on disk is. I've also seen a huge difference between select count(*) and select count(1) in older versions, haven't tried it on a recent version however.
---------------------------------
Frank Wiles <frank@no-spam>
http://www.wiles.org ---------------------------------

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

From: frank@no-spam (Frank Wiles)
Subject: Re: Seqscan rather than Index
Date: Mon, 20 Dec 2004 13:40:59 -0600

On Fri, 17 Dec 2004 23:37:37 -0500
Tom Lane <tgl@no-spam> wrote:

> Frank Wiles <frank@no-spam> writes:
> > I've also seen a huge difference between select count(*) and > > select count(1) in older versions,
> > That must have been before my time, ie, pre-6.4 or so. There is > certainly zero difference now.

Yeah now that I think about it that sounds about the right time frame I last benchmarked it.
---------------------------------
Frank Wiles <frank@no-spam>
http://www.wiles.org ---------------------------------

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org