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: Performance problems
Date Thu, 27 Nov 2003 07:57:32 GMT
    Hello Josh,

    What happens is the torque loads each object (if its doesn't have it 
already ) from the DB.
You should try to use the methods doSelectJoin .... to tell torque that 
make a join in the tables
and load all objects form one shoot, or i think better is to make your 
own method
 doSelectAccountJoinByJobsJoinByCategory :).
    Another way would be to create a view in your DB that contains all 
info you need to display and generate for that aslo
torque classes. This will work olny if you read the info only (i.e. a 
report on screen or something like that)
but not making modfications (insert/update/delete) beacause i don't know 
how these works on views.

Best wishes,

Josh Holtzman wrote:

> I'm using torque in a webapp, and I'm seeing really slow performance 
> when I try to get data from "nested" objects.  Here's what I mean:
> I have a torque object named Account.  An account can have several 
> Assignments, which is another torque object.  An assignment can have 
> Jobs (yup -- another torque object) and a Job can have a Category (yet 
> another torque object).  Due to the amount of data stored in each of 
> these, they must be separate objects (I'm trying to avoid eliciting 
> the obvious solution "put all of that info in one object" suggestion).
> I grab a list of accounts in my servlet with a doSelect(criteria) and 
> send them to a JSP to be displayed (I'm using struts, but that's 
> beside the point).  If I ask the JSP to just display info in the 
> Account object, everything runs quickly.  If I ask the JSP to get the 
> Account's Assignments and display info from the Assignments, it slows 
> down a bit.  Once I ask for Job or category info, it grinds to a crawl.
> I'm wondering what's going on when I ask the JSP to 
> account.getAssignments().  Is the JSP hitting the database in order to 
> instantiate the account's assignments?  I would think that when I 
> instantiated the Account, all of its own internal objects (the 
> assignments, the jobs, the categories) would also be instantiated.  So 
> why then the huge performance hit?
> I know that I am missing something here, so please, all of you Torque 
> gurus, let me know where young grasshopper has strayed from the path.  
> And if I need to provide more details (code, etc), I can do that too.
> Thanks so much,
> Josh
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

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

View raw message