[Glass] Queries in Gemstone ...

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Sun Feb 8 08:46:04 PST 2015


Marten,

If you were to use indexes, then you'd put an index on x.z, query on x.z 
= ??? and then sort the result set on x.q.

If the result set for x.z = ??? is very large then then the cost of 
sorting the result can outweigh the advantage of the quick initial lookup.

You could maintain a KeyValueDictionary where the keys map to the value 
of x.z and the values are sorted collections or indexed collections. Use 
an index if the x.q value is expected to change.

If the value of x.q is likely to change and you need automatic updates, 
you can arrange to use modification tracking to update the dictionary 
when x.q changes ...

Dale


On 2/8/15 7:02 AM, itlists at schrievkrom.de via Glass wrote:
> ... and I sometimes ask me, how this can be done in an efficient way in
> Gemstone:
>
> select x from y ordered by x.q where x.z = .... limit n
>
>
> Get thy entries from set/bag y where the attribute z of the instance has
> the value ... and the result should be ordered via attribute q and I
> only need the first n entries.
>
>
> Marten
>



More information about the Glass mailing list