Aside from the obvious idea that queries should be able to set
index/limit, I'm thinking we should modify the behavior of relationship
getting methods. Currently they return a List from xxxArray
relationships. I'm thinking we should implement the List interface, and
provide special index/limit/fetchSize methods in our implementation.
This way old code continues working as is and new code that wishes to
optimize performance does something like this:
List images = dataObject.getImageArray();
CayenneList typedImages = (CayenneList) images;
// (optional) configure List before using it
typedImages.setFetchSize(10);
typedImages.setMinIndex(15);
typedImages.setMaxIndex(30);
// use list like we always did
typedImages.get(20);
now... min/max indexes are hints to the List implementation as to what
index/limit values to issue the query with. If a user tries to get() an
index outside this range we will issue a second query but this is
unlikely to happen. The typical usage scenerio would be if the above had
100,000 rows in the result we'd see a noticable performance benefit of
only retrieving 15 rows (index 15 - 30 inclusive). And best of all, this
change is completely backwards compatible with older releases. What do
you think?
Gili
-- http://www.desktopbeautifier.com/
This archive was generated by hypermail 2.0.0 : Mon Sep 05 2005 - 03:28:40 EDT