Re: Index ignored on column containing mostly 0 values
В списке pgsql-performance по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Index ignored on column containing mostly 0 values |
| Дата | |
| Msg-id | 23894.1162269629@sss.pgh.pa.us обсуждение |
| Ответ на | Index ignored on column containing mostly 0 values (Leif Mortenson <leiflists@tanukisoftware.com>) |
| Список | pgsql-performance |
Leif Mortenson <leiflists@tanukisoftware.com> writes:
> Having a column containing large numbers of null or 0 values seems fairly
> common.
You would likely be better off to use NULL as a no-value placeholder,
instead of an arbitrarily chosen regular value (which the planner cannot
be certain does not match any entries in the other table...)
> Is there way to tell Postgres to create an index of all values with
> meaning. Ie all non-0 values? None that I could find.
Partial index. Though I'm not sure that would help here. The problem
is that the nestloop join you want would be spectacularly awful if there
happened to be any zeroes in bars.id, and the planner's statistical
estimates allow some probability of that happening.
regards, tom lane
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера