hstore equality-index performance question - Mailing list pgsql-general

From Stefan Keller
Subject hstore equality-index performance question
Date
Msg-id 25bc040b1003281557l72df790csd818d1b258043744@mail.gmail.com
Whole thread Raw
Responses Re: hstore equality-index performance question  (Sergey Konoplev <gray.ru@gmail.com>)
List pgsql-general
Documentation at "F.13.3. Indexes" says that "hstore has index support
for @> and ? operators..."
=> Therefore no index does support equality-indexes?

If so, then I suppose that following (potentially slow) query
which contains an equality test for all keys 'a' and returns all values...

  SELECT id, (kvp->'a') FROM mytable;

... can be accelerated nevertheless by adding following where clause:

  SELECT id, (kvp->'a') FROM mytable WHERE kvp ? 'a';

=> Is this correct?

-S.

-- Little test database
CREATE TABLE mytable (
  id serial PRIMARY KEY,
  kvp HSTORE
);
CREATE INDEX mytable_kvp_idx ON mytable USING GIN(kvp);
INSERT INTO mytable (kvp) VALUES ('a=>x, b=>y');
INSERT INTO mytable (kvp) VALUES ('a=>y, c=>z, d=>a');

pgsql-general by date:

Previous
From: David Kerr
Date:
Subject: Re: Connection Pooling
Next
From: Filip Rembiałkowski
Date:
Subject: Re: optimizing import of large CSV file into partitioned table?