Re: Planner question - "bit" data types

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Planner question - "bit" data types
Дата
Msg-id 7813.1252184367@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Planner question - "bit" data types  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: Planner question - "bit" data types  (Karl Denninger <karl@denninger.net>)
Список pgsql-performance
Merlin Moncure <mmoncure@gmail.com> writes:
> If you are only interested in one or a very small number of cases of
> 'permission', you can use an expression index to target constant
> values:

> "select ... from .... where ...... and (permission & mask = permission)"

> create index foo_permission_xyz_idx on foo((64 & mask = 64));
> select * from foo where 64 & mask = 64; --indexed!

A possibly more useful variant is to treat the permission condition
as a partial index's WHERE condition.  The advantage of that is that
the index's actual content can be some other column, so that you can
combine the permission check with a second indexable test.  The index
is still available for queries that don't use the other column, but
it's more useful for those that do.

            regards, tom lane

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

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: Planner question - "bit" data types
Следующее
От: Karl Denninger
Дата:
Сообщение: Re: Planner question - "bit" data types