Re: [SQL] selecting from indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Tim Joyce" <tim(at)hoop(dot)co(dot)uk>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] selecting from indexes
Date: 1999-11-19 22:18:52
Message-ID: 3610.943049932@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Tim Joyce" <tim(at)hoop(dot)co(dot)uk> writes:
>>>> select id from books, book_words where book_words.word='happy' and
>>>> book_words.id = books.id and books.category_key=1471;
>>
>> If this is what you're really doing, I think what you actually want is
>> indexes on book_words.word and books.id.

> I have indexes on both of these.

Hmm. So the question is why the system is (apparently) doing an
indexscan on category_key rather than on id. You didn't show us
the EXPLAIN output...

regards, tom lane

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tim Joyce 1999-11-19 22:55:48 Re: [SQL] selecting from indexes
Previous Message Tim Joyce 1999-11-19 20:06:34 Re: [SQL] selecting from indexes