Re: [SQL] selecting from indexes - Mailing list pgsql-sql

From Tom Lane
Subject Re: [SQL] selecting from indexes
Date
Msg-id 3610.943049932@sss.pgh.pa.us
Whole thread Raw
In response to Re: [SQL] selecting from indexes  ("Tim Joyce" <tim@hoop.co.uk>)
List pgsql-sql
"Tim Joyce" <tim@hoop.co.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


pgsql-sql by date:

Previous
From: "Tim Joyce"
Date:
Subject: Re: [SQL] selecting from indexes
Next
From: "Tim Joyce"
Date:
Subject: Re: [SQL] selecting from indexes