db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andras Balogh <and...@reea.net>
Subject Re: Back to back save is slow
Date Tue, 19 Oct 2004 06:52:53 GMT
Hello,

    How are these 1000 Books changed? There is a common pattern of these 
changes?
i.e. can be expressed like:
update books set somefields=values where somefields=conditions?
    I think in this case you can use BookPeer.doUpdate(Criteria,Criteria).

Best regards,
Andras.


Husek, Paul wrote:

>Hello fellow Torquers,
>
> 
>
>I like how Torque allows you to retrieve a list of Torque objects with a
>single select.  That's great!  I'm looking for something similar for save()
>
> 
>
>I'm doing some profiling on my application and see that a lot of time is
>being used in the part of code where I save about 1000  Torque objects back
>to the database; they are all the same type.  Right now the code is
>essentially a for loop doing a save() on each object.   I'm wondering if
>there is a way to speed this up, by effectively passing an array of objects
>to be saved in a single method and allowing the Torque engine to only do a
>single prepare.
>
> 
>
>Instead of 
>
>for (int i=0;i<books.length;i++) {
>
>   Book book=(Book)books[i];
>
>   book.save();
>
>}
>
> 
>
>The save method is taking up the vast majority of the time in this loop of
>course.
>
> 
>
>Maybe something like BookPeer.save(books);
>
> 
>
>Is there any method like this or any easy way to accomplish what I'm looking
>for?
>
> 
>
>Thanks much!
>
> 
>
> 
>
> 
>
> 
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message