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') = '
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
> 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';
>>>
>>> =>
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
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
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