Re: flattened prefetches

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Oct 03 2005 - 17:27:32 EDT

  • Next message: Cris Daniluk: "Re: flattened prefetches"

    > In some cases, I'd agree - though in other cases I would not. For
    > example, if I query across the relationship by path
    > (query.addPrefetch("toHouse.toCity")), then when I invoke
    > person.getToCity, it should work.

    Hmm... I haven't looked at the case of flattened relationships
    overlapping with regular ObjRelationship. Maybe we should generally
    treat them as cover methods without any DB magic? Otherwise you'd
    have your object graph easily messed up (I had such bad experience
    with EOF).

    >
    >> query.addPrefetch(String); // Cayenne decides which one to use
    >> query.addPrefetch(String, int type); // User decides which type to
    >> use
    >
    > What would the deciding factor be? Currently, the resolver
    > automatically converts joint prefetches to straight prefetches if the
    > user does a dangerous query. Maybe it could be reversed so that its
    > made into a joint prefetch if it *isn't* dangerous..

    I am not entirely clear on the deciding factor. It requires more
    analysis. This was the reason I kind of left it hanging up in the air
    when I first added joint prefetches.

    It will be hard to guess performance impact of such decision as it
    depends on many factors (the number of rows in each participating
    table, db indexes, etc.) So we should concentrate on correctness
    first. The simplest algorithm would be to use disjoint prefetches
    unless we know that it won't give Cayenne enough info, and then
    switch to joint. We can be "creative" and combine both types (i.e.
    root table is fetched in its own query, related table is fetched in
    combination with a joint table to avoid inner join inconsistencies
    that I think I mentioned somewhere in the docs).

    Andrus



    This archive was generated by hypermail 2.0.0 : Mon Oct 03 2005 - 17:27:34 EDT