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

From Kashmira Patel \(kupatel\)
Subject Re: Question about index scan vs seq scan when using count()
Date
Msg-id 18AE59788A3FC640A367E5652E664D800199BEF9@xmb-sjc-237.amer.cisco.com
Whole thread Raw
In response to Question about index scan vs seq scan when using count()  ("Kashmira Patel \(kupatel\)" <kupatel@cisco.com>)
List pgsql-sql
The index has been around since I first created the table. I did VACUUM
ANALYZE, that should have taken care of analyzing this table, right?

-----Original Message-----
From: Tomas Vondra [mailto:tv@fuzzy.cz]
Sent: Thursday, February 23, 2006 2:29 PM
To: Kashmira Patel (kupatel)
Subject: Re: [SQL] Question about index scan vs seq scan when using
count()

> What am I doing wrong here? I want it to use my index.

For small tables the sequential scan is faster, that means less disk
reads is required the whole table than to use the index.

If it is a large table, the index should be used. Have you created the
index recently? Have you analyzed the table since that time (ANALYZE
tablename)

t.v.


pgsql-sql by date:

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