Re: Index usage - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Index usage
Date
Msg-id Pine.LNX.4.30.0106091819420.778-100000@peter.localdomain
Whole thread Raw
In response to Index usage  (Subra Radhakrishnan <subra100@yahoo.com>)
List 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@gmx.net   http://funkturm.homeip.net/~peter



pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Inconsistent usage of Index
Next
From: "Joe Conway"
Date:
Subject: Re: Inconsistent usage of Index