Re: Question about index scan vs seq scan when using count()

From: "Kashmira Patel \(kupatel\)" <kupatel(at)cisco(dot)com>
To: "Tomas Vondra" <tv(at)fuzzy(dot)cz>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Question about index scan vs seq scan when using count()
Date: 2006-02-23 22:35:16
Message-ID: 18AE59788A3FC640A367E5652E664D800199BEF9@xmb-sjc-237.amer.cisco.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fuzzy(dot)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.

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2006-02-23 22:47:23 Re: Question about index scan vs seq scan when using count()
Previous Message Kashmira Patel (kupatel) 2006-02-23 22:25:34 Re: Question about index scan vs seq scan when using count()