ActiveRecord I have a query which :include 3 associated model,I have test them,if i include 2 of them the cost is low,about 0.x seconds,but the 3rd one will cost 2-3 seconds if i include it,that is a relationship model which contains (id,call_id,faq_id,created_on,updated_on,lock_version),why only include this will rise my cost?just because of this table has two foreign keys?? And I also found if change the multiple tables query into find_by_sql,the performance is still poor,but if the query is executed in MS query analyser then the response time is gonna be zero So,all the time was spent on translating the data into object by rails? I dont know how to optimize my application Especially optimize the database operation via rails Any suggestions? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jin Han wrote:> that is a relationship model which > contains (id,call_id,faq_id,created_on,updated_on,lock_version),why only > include this will rise my cost?just because of this table has two > foreign keys??Are the search keys indexed on the 3rd table?> So,all the time was spent on translating the data into object by rails?Which database, environment, database driver are you using? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Joachim Glauche wrote:> Jin Han wrote: >> that is a relationship model which >> contains (id,call_id,faq_id,created_on,updated_on,lock_version),why only >> include this will rise my cost?just because of this table has two >> foreign keys?? > Are the search keys indexed on the 3rd table?Not yet,till now I did index any of the tables> >> So,all the time was spent on translating the data into object by rails? > Which database, environment, database driver are you using?Sorry for my mistake Production : MS SQL Server,Lighttpd,ADO.rb Development : MS SQL Server,Mongrel,ADO.rb looking forward to you -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---