Index question

From: martin(dot)chantler(at)convergys(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Index question
Date: 2000-12-08 11:02:06
Message-ID: 852569AF.003CBE10.00@notes.cbis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is there any reason an index would not be used in optimising a query?
I have an SQL which does a join and correctly picks up an index on a numeric
column
but fails to use another index that is on a character column (char I think)
Maybe its because its character column - as most joins are done on numeric
values

I just wondered if theres a simple answer to this? If not I'll post the SQL
which I don't have
with me!

I think the SQL went something like this:

Select * From Order JOIN Customer ON Customer.account_no = Order.account_no
WHERE Order.order_no = 12345

The explain function told me it was using the index on order_no but scanning the
customer
table!

Either a) I've made a stupid mistake
or b) Something else

PS Is there a way of finding out which indexes exist on a table???

Thanks in advance,

MC.

--
NOTICE: The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or entity
to which it is directed and may contain information that is privileged or
otherwise confidential. If you have received this electronic mail transmission
in error, please delete it from your system without copying or forwarding it,
and notify the sender of the error by reply email or by telephone (collect), so
that the sender's address records can be corrected.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francis Solomon 2000-12-08 11:20:26 RE: Index question
Previous Message Martin Willms 2000-12-08 10:49:05 Privilegs on columns in PostgreSQL?