[PERFORM] index of only not null, use function index?

Поиск
Список
Период
Сортировка
От Ariel
Тема [PERFORM] index of only not null, use function index?
Дата
Msg-id alpine.DEB.2.11.1705221035530.21869@cherryberry.dsgml.com
обсуждение исходный текст
Ответы Re: [PERFORM] index of only not null, use function index?  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-performance
I need to be able to quickly find rows where a column is not null (only a
small percent of the rows will have that column not null).

Should I do:

CREATE INDEX ON table ((col IS NOT NULL)) WHERE col IS NOT NULL

or:

CREATE INDEX ON table (col) WHERE col IS NOT NULL

I'm thinking the first index will make a smaller, simpler, index since I
don't actually need to index the value of the column. But are there any
drawbacks I may not be aware of? Or perhaps there are no actual benefits?

      -Ariel


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [PERFORM] Bulk persistence strategy
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: [PERFORM] Bulk persistence strategy