db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lin <xuhua....@gmail.com>
Subject Re: Back to back save is slow
Date Fri, 15 Oct 2004 17:41:42 GMT
One alternative is to use JDBC batch insert/update to reduce trips to
database. You have to build your own prepared statement for this,
though. (not Torque)

Howard


On Fri, 15 Oct 2004 12:58:55 -0400, Husek, Paul <paul.husek@pfizer.com> 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