Open rodo opened 9 years ago
hi @rodo, sorry for the delayed answer.
We are open for improvements.
@niwibe @fabiocorneti any thoughts on this?
Looking at the code in query.py (verified), this behavior seems to kick in when you are querying on more than one key
Another place to look at is: https://github.com/djangonauts/django-hstore/blob/master/django_hstore/lookups.py
Unfortunately there is some code duplication because for django >= 1.7 the new lookups are used.
BTW @rodo we are open for improvements
This is a fairly significant issue, as GIN/GiST indexes are only used with @>
:
> explain select * from people where fields->'first_name' = 'David'
Seq Scan on people (cost=0.00..44.84 rows=5 width=113)
Filter: ((fields -> 'first_name'::text) = 'David'::text)
> explain select * from people where fields @> 'first_name=>David'
Index Scan using people_fields_gist on people (cost=0.00..8.27 rows=1 width=113)
Index Cond: (fields @> '"first_name"=>"David"'::hstore)
Ideally there would be syntax which would make the operator (==
versus @>
) explicit so the query could be tailored to the underlying indexes.
Practical proposals still welcome.
Hi,
I probably miss something, I'm a end user of django-hstore and just discover that when doing
Cerise.objects.filter(data__contains={'org': 'foo'})
the query executed use the = operator instead of @> that I presume
When I would see
WHERE data @> 'soc=>"breme"'::hstore;
If I do not miss anything, will you be open for a path to use @> operator, that is really more efficient with right indexes (not in this obvious case)