RE: Memory usage and select statements

From: Scott Anderson (sanderso..irvana.com)
Date: Mon Jun 30 2008 - 08:23:12 EDT

  • Next message: Andrus Adamchik: "Re: Memory usage and select statements"

    If I'm not mistaken, using an incomplete SQLTemplate statement will allow fetching of incomplete DataObjects, and Cayenne will not go back to the database again until you try to access unfetched data.

    At least, that's what I remember the behavior being; SELECTs occurred when I stopped at a breakpoint where cayenne was persuaded to resolve DataObjects for display in the debugger's trace window.

    -----Original Message-----
    From: Andrus Adamchik [mailto:andru..bjectstyle.org]
    Sent: Monday, June 30, 2008 5:01 AM
    To: use..ayenne.apache.org
    Subject: Re: Memory usage and select statements

    There is no lazy fetching of attributes (only relationships). We will
    be adding it at some point. It is a bit more involved than simply
    suppressing a given column in the SQL translator. Still you have a few
    of options:

    1. Place large columns in a separate table with 1..1 relationship to
    the master table .
    2. Do not map large columns in the ObjEntity and resolve them manually
    on demand (either with SQLTemplate, or by mapping a second entity to
    the same table).
    ...

    Andrus

    On Jun 30, 2008, at 11:54 AM, Řyvind Harboe wrote:
    > An SQL statement includes a list of which columns to fetch for
    > the query.
    >
    > Consider a table "book" with three columns, id(pk), title(<100 chars)
    > and content(the entire text of the book).
    >
    > SELECT id, title FROM book
    >
    > If one of the columns are big and rarely used, then it makes little
    > sense to transfer it to the client from the database for every
    > query. E.g. above the entire text of the book is left out.
    >
    > The difference in memory usage can be quite dramatic.
    >
    > Can I do the same w/Cayenne?
    >
    > Can I have the columns fetched on-demand?
    >
    > I'd like to avoid hardcoded SQL templates obviously.
    >
    > SelectTranslator.createSqlString() unconditionally adds all
    > columns...
    >
    > --
    > Řyvind Harboe
    > http://www.zylin.com/zy1000.html
    > ARM7 ARM9 XScale Cortex
    > JTAG debugger and flash programmer
    >



    This archive was generated by hypermail 2.0.0 : Mon Jun 30 2008 - 08:24:12 EDT