On Apr 12, 2006, at 4:09 PM, Owen McKerrow wrote:

I have been using the first method but after talking with a college yesterday Im wondering if the second way may be quicker. The in-memory will stil require a trip( or several to the DB ) to get the position sets, and then have to do the sort in memory once they get back. But if I have set the relationships Batch Faulting size, would these objects not already be in memory and thus we then cut down on the trip to the DB ?

It really is dependant on the state of your object store. If you have to go to the database to get the data, sorting at the database will almost always be preferable, particularly if you have an index on the sorted column (which turns sorting from O(nlogn) to O(1)). However, if your objects are already in memory, sorting in memory will almost always be preferable, simply because going to the database is expensive. With a large dataset (10s of 1000s of rows at least) in which you only intend to show the first few rows, you're almost always better off going to the database because sorting time will overshadow communication time with the database...

HTH,


sacha


--
Sacha Michel Mallais            800 kg gorilla
Global Village Consulting Inc.   http://www.global-village.net/
PGP Key ID: 7D757B65             AIM: smallais
1. Never tell everything at once.
-- Ken Venturi, Ken Venturi's Two Great Rules of Life



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to