Re: Prefetching and paginated queries

From: Stefaan Huysentruyt (cayenne.user..inimoa.net)
Date: Wed Oct 27 2004 - 04:42:15 EDT

  • Next message: Hogue, Brian: "modeler error message on objEntity delete"

    On 27-okt-04, at 04:23, Derek Rendall wrote:
    > (1) creating a temporry table containing the results for one page, and
    > joining on that for the prefetched relationship - sounds really dodgy
    > to do in a cross DB manner
    >
    > (2) grabbing all the ids for the page and then doing a select on the
    > relationship using an IN qualifier or similar

    > Unless someone has another alternative and/or an easier way to get
    > this going?

    Another alternative is possible when you use an ordered fetch.

    You frame your fetches to the number or items used at one time.
    You retain the first and the last order value fetched per frame, and go
    on using the last as the first parameter for your next frame.
    The advantage is that you can wrap your scrolling, and even scroll
    back, while relying on the latest updates in the database while you
    were scrolling. This requires some extra effort and complexity for
    consistently managing the row frame order values.

    If you have lots of duplicate ordering qualifier values, include
    another qualifier in the order criteria to fine grain your row frames.

    I don't know Cayenne well enough to see if it embeds supports for this
    in one way or another, but this solution should be ORM independent.

    Hope I understood the problem.

    Stefaan Huysentruyt

    "Be liberal in what you accept, and conservative in what you send."
    -- Jon Postel (August 6, 1943 - October 16, 1998)
    Internet Pioneer - http://www.postel.org/postel.html



    This archive was generated by hypermail 2.0.0 : Wed Oct 27 2004 - 04:42:19 EDT