Re: Performance question

From: Cris Daniluk (cris.danilu..mail.com)
Date: Tue Jan 17 2006 - 14:33:28 EST

  • Next message: Andrus Adamchik: "Re: iReport/Cayenne integration"

    > Code:
    > Expression qualifier = ExpressionFactory.matchExp(
    > PersonelCard.CARD_NO_PROPERTY, cardNo);
    > SelectQuery query = new SelectQuery(PersonelCard.class,qualifier);
    > query.setDistinct(true);
    > query.setCachePolicy(GenericSelectQuery.SHARED_CACHE);
    > query.setRefreshingObjects(true);
    > query.setFetchingDataRows(true);
    > List cards = context.performQuery(query);
    >

    I'm with Tore... in this case, DataRows aren't going to do you any
    good. DataRows don't make data queries faster, just object
    construction... and since you're only constructing 1 object....

    On the other hand, is CARD_NO indexed? A repeated table scan is
    expensive. Indexes rule. If its not, distinct makes it even worse - I
    would avoid using distinct here, particularly since you're not doing a
    join. Just ignore the second, third, etc results if you only want one.

    Finally, why are you running this every second if its cached???

    Cris



    This archive was generated by hypermail 2.0.0 : Tue Jan 17 2006 - 14:33:30 EST