Another thing to remember is that the parent object will only attempt to save the child objects that have been retrieved - if you used a Criteria to limit the number of child objects to say 100, then only the 100 child objects would be potentially saved when the parent is saved. The overhead in saving 1M+ records (looping through the list and saving only the new and modified records) is likely to be far less than that required to retrieve that many records (and why are you retrieving this many records when the user can't possible be viewing them all). If the number of child records being retrieved, updated or created is such that it is affecting performance then I would suggest that the application is not designed properly (the schema may require further normalization).
HTH, Scott -- Scott Eade Backstage Technologies Pty. Ltd. http://www.backstagetech.com.au > From: Scott Eade <[EMAIL PROTECTED]> > Reply-To: "Turbine Torque Users List" <[EMAIL PROTECTED]> > Date: Thu, 10 Oct 2002 00:00:17 +1000 > To: Turbine Torque Users List <[EMAIL PROTECTED]> > Subject: Re: save called a 1000 times > >> From: "Akmal Sarhan" <[EMAIL PROTECTED]> >> >> thank you Scott for the answer, still the question is why does the save() >> method iterate through "all" the old cars to save them,having in mind that I >> add a new Car entry to an Agent that already exists i.e I only update it by >> adding the new Car, and if this Agent already has, say, 1M+ Cars, so I think >> you might get my point about the performance issue. >> >> best regards >> Akmal > > The problem is that even though you may save the new Car directly, any > change to the Agent that requires a save() is going to iterate through the > 1M+ rows. You are talking a really extreme example (yesterday you were > happy to talk 1000, but today you want to talk 1M+), one where you would no > doubt review and overload the default save() (and other) method(s) in order > to cope with such large volumes. > > I think it would be reasonably easy to break most persistence frameworks > using an extreme examples such as this. > > Cheers, > > Scott > -- > Scott Eade > Backstage Technologies Pty. Ltd. > http://www.backstagetech.com.au > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
