Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Better operator class for hstore: smaller index and faster @> queries.

NotificationsYou must be signed in to change notification settings

postgrespro/hstore_ops

Repository files navigation

hstore_ops extension provides another implementation of GIN index (opclass)for hstore - gin_hstore_hash_ops. It provides smaller index and faster @>operator queries than default GIN opclass. However, queries containing ?,?|, ?& operators could become a bit slower.

Idea of this opclass is to use composite GIN key which consists of hashesof hstore key and value. Thus, search for @> operator is possible as simplematch for each queried key-value pair. Search for @>, ?, ?|, ?& is possibleas partial match for each queried hstore key. Recheck is essential forevery kind of search, because of possible hash collision. Hashing providessmall size of index, mixing key and value into same GIN key provides highperformance for @> search operator.

Also hstore_ops extension contains gin_hstore_bytea_ops - variation ofstandard GIN opclass for hstore where collation key comparison is replacedwith per-byte comparison. This change doesn't affect any functionality,just makes index work faster when collation comparison is slow.gin_hstore_bytea_ops was introduced in version 1.1.

Authors

License

Development version, available on github, released under theGNU General Public License, version 2 (June 1991).

Downloads

Stable version of hstore_ops is available fromhttps://github.com/postgrespro/hstore_ops

Installation

hstore_ops is regular PostgreSQL extension depending on hstore contrib.To build and install it you should ensure in following:

  • You have development package of PostgreSQL installed or you builtPostgreSQL from source.
  • Your PATH variable configured so that pg_config command available.
  • You did "CREATE EXTENSION hstore;" before "CREATE EXTENSION hstore_ops;".

Typical installation procedure may look like this:

$ git clone https://github.com/postgrespro/hstore_ops.git$ cd hstore_ops$ make USE_PGXS=1$ sudo make USE_PGXS=1 install$ make USE_PGXS=1 installcheck$ psql DB -c "CREATE EXTENSION hstore_ops;"

If you used hstore_ops 1.0 then replace last command to upgrade to 1.1.

$ psql DB -c "ALTER EXTENSION hstore_ops UPDATE TO '1.1';"

Usage

Just create index on hstore column using one of following commands.

CREATE INDEX index_name ON table_name USING GIN (column_name gin_hstore_hash_ops);CREATE INDEX index_name ON table_name USING GIN (column_name gin_hstore_bytea_ops);

Index will be automatically used for search on @>, ?, ?|, ?& operators on thiscolumn.

About

Better operator class for hstore: smaller index and faster @> queries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp