Re: prefetch in 1.1M4

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Mar 10 2004 - 02:00:29 EST

  • Next message: Tore Halset: "Re: prefetch in 1.1M4"

    Tore,

    Could you create a sample app demonstrating this failure and attach it
    to CAY-105 issue. I tried quiet a few different things, like compound
    PK, relationships based on CHAR and DECIMAL columns, etc., but could
    never reproduce this problem - prefetching just works for me.

    Thanks
    Andrus

    On Mar 9, 2004, at 10:48 AM, Andrus Adamchik wrote:

    > Hi Tore,
    >
    > Thanks for reporting this issue. I just opened a ticket for further
    > investigation:
    > http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-105
    >
    > Andrus
    >
    >
    > On Mar 9, 2004, at 4:47 AM, Tore Halset wrote:
    >
    >> Hello.
    >>
    >> I tried to upgrade from 1.0.6 to 1.1M4 in our main application now.
    >> Prefetching does not seem to work..
    >>
    >> One example. We have a table called "cell" with "cell_id" (char(8))
    >> as primary key. Another table is called cell_coverage and has a
    >> compound primary key that consist of "cell_id" (char(8)), "area"
    >> (int) and "coord_id" (decimal). There is a one-to-many relalationship
    >> between cell and coverage.
    >>
    >> The code:
    >> SelectQuery q = new SelectQuery(Cell.class);
    >> // does not work after upgrade to cayenne-1.1M4 :(
    >> q.addPrefetch("cellCoverages");
    >> dataContext.performQuery(q);
    >>
    >>
    >> This is the output for a query on cell with prefetch on cell_coverage.
    >> 10:36:20,962 INFO [QueryLogger] --- will run 2 queries.
    >> 10:36:20,963 INFO [QueryLogger] --- transaction started.
    >> 10:36:21,028 INFO [QueryLogger] SELECT t0.CELL_ID, ...<other
    >> fields>... FROM CELL t0 - prepared in 50 ms.
    >> 10:36:22,187 INFO [QueryLogger] === returned 1631 rows. - took 1222
    >> ms.
    >> 10:36:22,201 INFO [QueryLogger] SELECT t0.AREA, t0.COORD_ID,
    >> t0.LATITUDE, t0.LONGITUDE, t0.CELL_ID FROM CELL_COVERAGE t0 -
    >> prepared in 12 ms.
    >> 10:36:23,880 INFO [QueryLogger] === returned 15877 rows. - took 1692
    >> ms.
    >>
    >> That looks correct for me. Every cell_coverage should be in the cache
    >> and nothing should be a fault.
    >>
    >> The problem is that when I loop the cells to print out the coverages
    >> cayenne-1.1M4 fetches the coverages once more. This will currently
    >> leed to 15877 extra roundtrips to the database...
    >>
    >> 10:36:28,109 INFO [QueryLogger] --- will run 1 query.
    >> 10:36:28,111 INFO [QueryLogger] --- transaction started.
    >> 10:36:28,113 INFO [QueryLogger] SELECT t0.AREA, t0.COORD_ID,
    >> t0.LATITUDE, t0.LONGITUDE, t0.CELL_ID FROM CELL_COVERAGE t0 WHERE
    >> (t0.COORD_ID = ?) AND (t0.AREA = ?) AND (RTRIM(t0.CELL_ID) = ?)
    >> [bind: 17210, 0, 'XX121212']
    >> 10:36:28,175 INFO [QueryLogger] === returned 1 row. - took 63 ms.
    >>
    >> This did not happen before I upgraded from cayenne-1.0.6 to
    >> cayenne-1.1M4.
    >>
    >> - Tore.
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Mar 10 2004 - 02:00:34 EST