Re: Index usage

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Subra Radhakrishnan <subra100(at)yahoo(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Index usage
Date: 2001-06-09 16:21:02
Message-ID: Pine.LNX.4.30.0106091819420.778-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Subra Radhakrishnan writes:

> Now, I create an index on the employee table using
> 'dept_num' as the attribute. And when I run select
> which looks like:
>
> Explain Select * from employee where dept_num =
> 'Finance';
>
> It does not use the index and tells me that a
> Sequential scan will be done on the table employee.
>
> How do I fix this?

Unless you can prove that an index scan is going to be faster than a
sequential scan, you don't. Just because there's an index doesn't mean
it's always the best choice to use it.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

  • Index usage at 2001-06-09 03:27:25 from Subra Radhakrishnan

Browse pgsql-sql by date

  From Date Subject
Next Message Postgresql 2001-06-09 16:22:51 cascading delete - recursivity
Previous Message Peter Eisentraut 2001-06-09 16:17:05 Re: Inconsistent usage of Index