Re: SelectQuery.setFetchLimit() performance

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Sep 10 2008 - 11:07:17 EDT

  • Next message: Laurent Marchal: "Returning updated rows from SQLTemplate"

    I think you are using prefetching, although this is not shown in your
    example. Otherwise why would Cayenne go after a related entity data.

    Unfortunately you when using prefetching with a fetch limit, the fetch
    limit is only applied to the root query. This is not a bug, this is
    needed for the result correctness. Pagination solution that Ari
    suggested should (indirectly) solve prefetching / fetch limit combo
    limitation.

    Andrus

    On Sep 10, 2008, at 5:57 PM, Michael Shea wrote:

    > Hm. I don't think that paging will solve the issue I am working on.
    > Basically, I have an API that returns objects which are constructed
    > from Cayenne DB-objects. We have a search() method in this API, and
    > it needs to support setting a limit on the number of objects
    > returned by the search (not paginating the result, just truncating
    > it).
    >
    > Currently, I am using setFetchLimit() on a SelectQuery for this.
    >
    >
    > Shea.
    >>
    >> On 10/09/2008, at 7:44 AM, Michael Shea wrote:
    >>
    >>> I am wondering about the performance of the
    >>> SelectQuery.setFetchLimit() method in Cayenne.
    >>
    >> What is the underlying action you are trying to optimise? Could it
    >> be that paging is a better match for giving you good performance in
    >> your situation? In that case Cayenne fetches full objects for the
    >> first page, and only ObjectId for the rest. Which is a lot like
    >> your proposal.
    >>
    >> Ari Maniatis
    >>
    >>
    >>
    >> -------------------------->
    >> ish
    >> http://www.ish.com.au
    >> Level 1, 30 Wilson Street Newtown 2042 Australia
    >> phone +61 2 9550 5001 fax +61 2 9550 4001
    >> GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
    >>
    >>
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Sep 10 2008 - 11:07:51 EDT