Re: Array index not used for query on first element?

Поиск
Список
Период
Сортировка
От John D. Burger
Тема Re: Array index not used for query on first element?
Дата
Msg-id 2C51C748-814C-4A20-800B-B61C51FDE87E@mitre.org
обсуждение исходный текст
Ответ на Re: Array index not used for query on first element?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:

>> It seemed reasonable to me that a select on the first element of an
>> array column could use an index on the column, but, as seen in this
>> example, I can't get it to do so:
>
> Nope.  The operators that go along with a btree index are equality,
> less than, etc on the whole indexed column.  btree knows nothing
> about extracting array elements.

I guess I was working by analogy with queries like this:

   select * from someTable where textColumn like 'foo%';

This will happily use an ordinary btree index on textColumn, right?
(Although I know it's only for the C locale with the default op
class.)  Anyway, I guess this is a far more common case than matching
the prefix of an array.  Like another poster suggested, I can have an
additional expression index on the first element of my array column.

- John Burger
   MITRE

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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: record-based log shipping
Следующее
От: Alex Vinogradovs
Дата:
Сообщение: Re: record-based log shipping