Re: [GENERAL] hstore equality-index performance question

2010-03-30 Thread Tom Lane
Stefan Keller 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') = '

Re: [GENERAL] hstore equality-index performance question

2010-03-30 Thread Stefan Keller
You are right, my negligence. I'm trying to optimize the latter query: # SELECT id, (kvp->'a') FROM mytable WHERE kvp ? 'a'; ...or something like this (which also involves the '->' operator) # SELECT id FROM mytable WHERE (kvp->'a') = 'x'; -S. 2010/3/29 Sergey Konoplev : >> My question is, if o

Re: [GENERAL] hstore equality-index performance question

2010-03-29 Thread Sergey Konoplev
> My question is, if one can get also index support for the '->' operator? I am not sure what do you mean. >>>  SELECT id, (kvp->'a') FROM mytable; >>> >>> ... can be accelerated nevertheless by adding following where clause: >>> >>>  SELECT id, (kvp->'a') FROM mytable WHERE kvp ? 'a'; >>> >>> =>

Re: [GENERAL] hstore equality-index performance question

2010-03-29 Thread Stefan Keller
Thank you Sergey for your reply. I'm not sure how your partial index makes a difference. Obviously the ? operator gets indexed: # EXPLAIN SELECT id, (kvp->'a') FROM mytable WHERE kvp ? 'a'; Index Scan using mytable_kvp_idx on mytable (cost=0.00..8.27 rows=1 width=36) Index Cond: (kvp ? 'a'::te

Re: [GENERAL] hstore equality-index performance question

2010-03-29 Thread Sergey Konoplev
On 29 March 2010 02:57, Stefan Keller wrote: > 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 t

[GENERAL] hstore equality-index performance question

2010-03-28 Thread Stefan Keller
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