Using indexes

From: Linh Luong <linh(dot)luong(at)computalog(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Using indexes
Date: 2001-05-30 22:37:58
Message-ID: 3B157646.EABF2998@computalog.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Indexes are used to find a record faster in a table.

It only seems to work if I am working with one table.
eg)
> create index customer_id_idx on customer(id);
> select * from customer where id=1;
-- This uses the index I create

However, when I start to join 2 or more tables together it doesn't seem
to use it.. WHY???

eg)
> create index customer_id_idx on customer(id);
> select * from customer, purchaseorder where customer.id=purchaseorder.id;

-- This results in a seq scan .. WHY??

Is there a way to make it so that it uses my index

Thanks again.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Bruce Momjian 2001-05-30 22:57:44 Re: Using indexes
Previous Message Josh Berkus 2001-05-30 21:33:02 Re: Unique record Identifier?