Hstore: Query speedups with Gin index

Поиск
Список
Период
Сортировка
От Blake Smith
Тема Hstore: Query speedups with Gin index
Дата
Msg-id CAPxT4eEe-MNs4FbVN1Le_nWsTgyw3N38tENbN5W7GPBrWB7cJA@mail.gmail.com
обсуждение исходный текст
Ответы Re: Hstore: Query speedups with Gin index
Список pgsql-hackers

Hey everyone,

I'm looking for feedback on a contrib/hstore patch.

We've been experiencing slow "@>" queries involving an hstore column that's covered by a Gin index. At the current postgresql git HEAD, the hstore <-> gin interface produces the following text items to be indexed:

hstore: "'a'=>'1234', 'b'=>'test'"
Produces indexed text items: "Ka", "V1234", "Kb", "Vtest"

For the size of our production table (10s of millions of rows), I observed significant query speedups by changing the index strategy to the following:

hstore: "'a'=>'1234', 'b'=>'test'"
Produces indexed text items: "Ka", "KaV1234", "Kb", "KbVtest" 

The combined entry is used to support "contains (@>)" queries, and the key only item is used to support "key contains (?)" queries. This change seems to help especially with hstore keys that have high cardinalities. Downsides of this change is that it requires an index rebuild, and the index will be larger in size.

Patch attached. Any thoughts on this change?

Thanks,

Blake
Вложения

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

Предыдущее
От: bricklen
Дата:
Сообщение: Re: pg_system_identifier()
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: pg_system_identifier()