[elephant-devel] inherited indices

Alex Mizrahi killerstorm at newmail.ru
Sun May 1 18:36:28 UTC 2011


 IE> One solution is to get rid of the :inherited option and simply allow a
 IE> :subclasses? option to get-instances-by-value/range that uses the mop
 IE> to find subclass indexes and does a merge sort of all objects returned
 IE> by the various indexes.  This becomes time O(k log_b n) and gets rid of
 IE> inherited indexing.

Yes, but it doesn't help with iteration with map-... functions and cursor, 
e.g. when you want latest 10 items or something like that.

Reading all items just to get 10 latest will have a huge performance impact.

It is possible to traverse multiple cursors at once, but it is weird and 
slow.

So I think while :inherit is not perfect it is a good tool to achieve 
desired results, especially together with derived indices -- you can do 
pretty much whatever you want, just API is less than perfect.

 IE> However, if the k is going to matter or you want a faster option, you
 IE> can keep :inherited (one big index) and have
 IE> get-instances-by--value/range filter out classes you didn't ask for
 IE> (i.e if base class get everything, if asking for subclass and inherited
 IE> then just return matching subclasses - you could even do this before
 IE> object instantiation to make it extremely efficient by testing the
 IE> schema ID associated with the OID (checking for older schemas that need
 IE> to be upgraded if schema upgrading is set to lazy)

I think let's start on a simple approach (filtering using typep) and then 
maybe implement a faster one.






More information about the elephant-devel mailing list