Is index enough to do simple fetch, or table is always used too?

Поиск
Список
Период
Сортировка
От Dmitry Koterov
Тема Is index enough to do simple fetch, or table is always used too?
Дата
Msg-id d7df81620812140421u507d0bbcudc6d1eac4f03a8a6@mail.gmail.com
обсуждение исходный текст
Ответы Re: Is index enough to do simple fetch, or table is always used too?
Список pgsql-general
Hello.

Suppose I have the following index:

CREATE INDEX idx ON tbl  USING btree (abc, def, id)

and perform the query with index scan:

SELECT md5(id)
FROM tbl
WHERE abc=1 AND def=2
LIMIT 200

The question: if the table "tbl" scanned to fetch "id" and calculate md5(id), or the value of "id" is brought directly from "idx" index with no table data access at all? The second behaviour is logical: why should we access the table if all the needed data is already in the index entry...

(Some time ago I have read something about this behaviour somewhere, but now cannot find it in the PostgreSQL documentation. Possibly it were words about another database, not Postges?)

В списке pgsql-general по дате отправления:

Предыдущее
От: Michael Hall
Дата:
Сообщение: Relational database design book
Следующее
От: "David Rowley"
Дата:
Сообщение: Re: Is index enough to do simple fetch, or table is always used too?