Re: Question about index scan vs seq scan when using count() - Mailing list pgsql-sql

From Andrew Sullivan
Subject Re: Question about index scan vs seq scan when using count()
Date
Msg-id 20060223224723.GG11392@phlogiston.dyndns.org
Whole thread Raw
In response to Re: Question about index scan vs seq scan when using count()  ("Kashmira Patel \(kupatel\)" <kupatel@cisco.com>)
List pgsql-sql
On Thu, Feb 23, 2006 at 02:25:34PM -0800, Kashmira Patel (kupatel) wrote:
> 
> [Kashmira] I did do an EXPLAIN ANALYZE as well, it also showed a
> sequential scan. The table has about 600+ rows, with around 6 of them
> matching the given id. Wouldn't an index scan be faster in this case?

EXPLAIN ANALYSE will always choose the same plan as EXPLAIN.  The
difference is that it shows you the estimate and actual.

I am surprised you're getting a seqscan for that, though.  Is there
something about the index you're not telling us?  

Is your system tuned correctly?  Maybe 600 rows is so small that a
seqscan's just as fast.

A

-- 
Andrew Sullivan  | ajs@crankycanuck.ca
"The year's penultimate month" is not in truth a good way of saying
November.    --H.W. Fowler


pgsql-sql by date:

Previous
From: "Kashmira Patel \(kupatel\)"
Date:
Subject: Re: Question about index scan vs seq scan when using count()
Next
From: "Kashmira Patel \(kupatel\)"
Date:
Subject: Re: Question about index scan vs seq scan when using count()