Re: Index usage

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Subra Radhakrishnan <subra100(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Index usage
Date: 2001-06-09 03:39:31
Message-ID: Pine.BSF.4.21.0106082038260.36872-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 8 Jun 2001, Subra Radhakrishnan wrote:

> Hi All,
>
> The index created by me is not being used while doing
> select. I found that out by using the EXPLAIN. For
> example:
>
> Table department has
> ----------------
> dept_num
> dept_desc
>
>
> Table 'employee' looks like this:
> --------------------------------
> emp_num primary key,
> emp_name,
> dept_num (this is by way of foreign key relation from
> department table)
>
> 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?

Have you run vacuum analyze, what's the full schema
(with types) and the explain output?

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 Subra Radhakrishnan 2001-06-09 15:18:02 Inconsistent usage of Index
Previous Message Subra Radhakrishnan 2001-06-09 03:27:25 Index usage