On 16/01/2008, at 10:54 PM, Daniel Kvasnička jr. wrote:

Well, but how scalable is this? If I understand it well, when I have
1000 articles in my DB, cayenne 2.0.x will FULLY query for ALL of the
1000 articles on EVERY page change, but will take only PKs from the
result rows beyond 1st page? This seems to me like a pretty extreme db
server load case.... If I imagine having a portal with thousands of
people per day browsing through articles... In success stories, there
are some companies that manage pretty big dbs with cayenne, how do
they manage these tables with paginated queries? Or am I missing
smthing?

Firstly, this is really quite fast. We use this approach on a Swing application (three tier) with our largest customer now with 120,000 contacts in one table. Pulling this across the network takes only a few seconds. Remember that Cayenne is just fetching the primary key from the database for all but the page of data you want to fault.

Secondly, what else can you do? After all, you've asked Cayenne for 1000 articles (or 120,000 students) and that's what you'll get. Perhaps you should qualify your query so that it doesn't return so many rows. Or else fetch the data on the first request and keep it in a session for the user to step through without creating another database query on each page request. Or even just fetch the data into some shared context that all users might browse through. Finally, if you know exactly which page of data you want, you might explore SQLTemplate with a LIMIT, but I don't think you will find it necessary.


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


Reply via email to