>-----Oorspronkelijk bericht-----
>Van: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED]]Namens Marcel Maatkamp
>Verzonden: maandag 19 augustus 2002 11:46
>Aan: [EMAIL PROTECTED]
>Onderwerp: proposal for new implementation in MMObjectNode and
>MMObjectBuilder
>
>
>The classfiles are downloadable on
>
> http://www.vpro.nl/MMObjectNode.java and
> http://www.vpro.nl/MMObjectBuilder.java
>
>Seems that attachments on my side are discarded
>-------------------------------------------------------------
>
>Hi,
>
>This bug is mentioned on butracker
>
>MMBase has a performance-issue regarding MMObjectNode::getRelated() and
>MMObjectNode::getRelated(type) where type is a builder.
>
>Imagine a person who has 20.000 relations with userratings and 1
>relation with an
>image. If I where to ask mmbase to get the
>person.getRelated(Images), the following
>will happen:
> 1.) the builder of type 'type' (image) will be fetched from mmbase
> 2.) mmbase gets *all* related nodes (20.001 in this example)
> 3.) it will check the otype of the node against the otype of the
>builder from step 1
> 4.) returns 1 image
>
>There are 3 major problems with this:
> - if you use inherited builders this current method will not
>work. If I ask getRelated(Mediaparts)
> the current implementation will return Mediaparts instead of
>the correct Audio/Videoparts
> - the nodecache will be filled with useless information (it will
>now contain the 20.001 nodes
> from the getRelated in the previous example; the current
>nodecache is only 16.000 orso,
> so a getRelated(type) on a node with many relations will
>invalidate the whole cache and is worthless
> at this point
> - to determine the otype of the node, the relationnumber is being
>queried on the object table field otype,
> after that the builder for that otype will do a 'SELECT * from
>buildername' to fetch the real values
> for the node.. This will result in 40.002 queries on the
>database for just one (1) image!
>
>My current proposed sollution for getRelated(type) works as follows:
> - query with a multilevel from this_node.parent -> type, this
>will return virtual nodes (contain otype and number)
> - check wether the node is in the nodecache, if so, return that,
>otherwise remember the number
> - query the builder in 1 search the uncached nodes, fetch those
>and fill in the real values (this will put the
> nodes automatically into the cache
> - returns the nodes
>
+1 seems like a good change, how much faster was it ?
Daniel.