pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Sullivan <ajs@crankycanuck.ca>
To: pgsql-sql@postgresql.org
Subject: Re: Question about index scan vs seq scan when using count()
Date: Thu, 23 Feb 2006 17:47:23 -0500
Message-ID: <20060223224723.GG11392@phlogiston.dyndns.org> (raw)
In-Reply-To: <18AE59788A3FC640A367E5652E664D800199BEE8@xmb-sjc-237.amer.cisco.com>
References: <18AE59788A3FC640A367E5652E664D800199BEE8@xmb-sjc-237.amer.cisco.com>

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



view thread (7+ messages)  latest in thread

Message-ID: <20060223224723.GG11392@phlogiston.dyndns.org>
Permalink:  ../20060223224723.GG11392@phlogiston.dyndns.org/
Also on:    postgresql.org/message-id/20060223224723.GG11392@phlogiston.dyndns.org

 · 

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-sql@postgresql.org
  Cc: ajs@crankycanuck.ca
  Subject: Re: Question about index scan vs seq scan when using count()
  In-Reply-To: <20060223224723.GG11392@phlogiston.dyndns.org>

* 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