Re: hstore equality-index performance question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: hstore equality-index performance question
Дата
Msg-id 24160.1269963833@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: hstore equality-index performance question  (Stefan Keller <sfkeller@gmail.com>)
Список pgsql-general
Stefan Keller <sfkeller@gmail.com> writes:
> I'm trying to optimize the latter query:
> # SELECT id, (kvp->'a') FROM mytable WHERE kvp ? 'a';

The hstore gist and gin opclasses contain support for that.

> ...or something like this (which also involves the '->' operator)
> # SELECT id FROM mytable WHERE (kvp->'a') = 'x';

You could transform this into a gist/gin indexable query

    kvp @> ('a' => 'x')

although I think the actually indexed part of it is just the search for
rows that contain key 'a', so it's not really any better than

    kvp ? 'a' AND (kvp->'a') = 'x'

performance-wise.

            regards, tom lane

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

Предыдущее
От: Stefan Keller
Дата:
Сообщение: Re: hstore equality-index performance question
Следующее
От: Andy Colson
Дата:
Сообщение: Re: User action accounting