Обсуждение: AW: [HACKERS] partial index

Поиск
Список
Период
Сортировка

AW: [HACKERS] partial index

От
Andreas Zeugswetter
Дата:
Bruce wrote:
>What is a partial index?  I have never known.

A partial index is one that only indexes a subset of a table (e.g. restricted by a where clause).

This can be useful in many cases, one typical case is where all rows that are not null
in the index fields are to be indexed:
create index people_idx on people (childname) where childname is not null;

Note that I just made up the syntax (or is it postgresql syntax?). Some code for it lurks around.

Informix uses another syntax with a complete select statement, so you can also index a join:

CREATE GK INDEX gki
(SELECT A.col1, A.col2 FROM A, B, C
WHERE A.col1 = B.col1 AND B.col1 = C.col1)


Andreas