Re: Index selection (and partial index) for BYTEA field

Поиск
Список
Период
Сортировка
От David Garamond
Тема Re: Index selection (and partial index) for BYTEA field
Дата
Msg-id 405BB5CF.5080903@zara.6.isreserved.com
обсуждение исходный текст
Ответ на Re: Index selection (and partial index) for BYTEA field  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Index selection (and partial index) for BYTEA field  (Joe Conway <mail@joeconway.com>)
Список pgsql-general
Tom Lane wrote:
>>explain tells me it is using the partial index. But when I create
>>partial index on the id column (BYTEA):
>>  create unique index i_partition_id_000 on partition(id)
>>  where id like '\\000%';
>
>>  explain select * from partition where id like '\\000\\001%';
>>says the query is using the PK index, not the partial index. Why is this so?
>
> The partial index matcher is not omniscient.  It knows a few things
> about btree-compatible comparison operators, but nothing about LIKE.
> Accordingly, this partial index will only get matched to queries that
> contain *exactly* "id like '\\000%'" in their WHERE clauses.

So I guess there's not a way that the partial index can be used instead
of the PK index (I couldn't find in FAQ/archives whether one can force
usage of one index over another).

--
dave


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

Предыдущее
От: Ericson Smith
Дата:
Сообщение: Re: "People near me" query
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: does this look more like a possible bug or more like