[elephant-devel] inherited indices

Vassilis Radis radisb at gmail.com
Thu Apr 28 08:16:49 UTC 2011


On Wed, Apr 27, 2011 at 10:34 PM, Alex Mizrahi <killerstorm at newmail.ru>wrote:

> > Currently, I do something along the lines of the following on the results
> > on get-instance[s]-by-XXX functions:
> > (remove-if #'(lambda (x) (not (member ',class-name (mapcar #'class-name
> > (sb-mop:class-precedence-list x))))) lst :key #'class-of)
> > if I want results on the whole inheritance chain, or
> > (remove-if #'(lambda (x) (not (equal ',class-name x)))) lst :key
> > #'class-of) if I want result on the specific class.
>
> I wonder why not just typep?
> It should be enough to answer any reasonable class-related query.


Yes I was wondering the same thing yesterday...  Lisp newbie here. Not
well acquainted with the tools yet :)


> > Now I know that efficiency is the issue here, but my (naive , since I
> > havent had performance problems yet) response to that is that since the
> > the search is indexed anyway, does it really matter?
> > I mean since the complexity of the search is logarithmic wont the
> separate
> > hierachical index implementation you propose have diminishing returns?
>
> If you consider only search then yes, in theory there should be no
> significant difference.
>
> But if multiple instances are returned you'll just have more data read and
> sent to the Lisp side, so it will be proportionally slower.
>
> Le'ts consider a situation when you have one base class and M subclasses,
> and each subclass has N instances matching a query on average.
> Then with simple inherited index you'll have N*M instances read from
> database, while direct index on subclass would return only N.
> Thus M times more data is read.
>

I totally agree with the rationale. How realistic this simple estimate is, I
agree (as you imply below) depends on the application.


> But it depends on expected value of N. If it is low (e.g N*M<1) then query
> time will be dominated by search but not data read or transfer. So it
> doesn't matter in this case.
> But if you queries you run typically return many instances it might be a
> problem.


You mean many instances of the subclasses dont you?

_______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20110428/1ed6f7d3/attachment.html>


More information about the elephant-devel mailing list