Hi, I am trying my hands on RoR for a dummy project and I use Mysql as my database. For data manipulation and querying purpose, should I write ruby code directly in active record or write a stored procedure and invoke a call through active record? I understand there are many advantages of stored procedures: 1. They can help enforce data security. 2.Amount of information sent over the N/W is less 3. No compilation step is required to execute code 4. Once the procedure is present in the shared pool, retrival from disk is not required everytime different users call the procedure i.e. reduction in disk I/O Many thanks, Tyche --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 6/9/07, Tyche <chandra.sonia-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > I am trying my hands on RoR for a dummy project and I use Mysql as my > database. For data manipulation and querying purpose, should I write > ruby code directly in active record or write a stored procedure and > invoke a call through active record? > I understand there are many advantages of stored procedures: > 1. They can help enforce data security. > 2.Amount of information sent over the N/W is less > 3. No compilation step is required to execute code > 4. Once the procedure is present in the shared pool, retrival from > disk is not required everytime different users call the procedure i.e. > reduction in disk I/O >With ActiveRecord, you can made all SQL querie that you want with several method of _sql or with a connection by driver. But it''s not needed. ActiveRecord made several method to avoid this SQL querie in your Ruby Code. So Avoid made SQL except for perform, but it''s not advisor by default. -- Cyril Mougel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
rschenk-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-10 15:34 UTC
Re: Usage of stored procedures
Hi Tyche, We call stored procs when we have to query a particularly unfriendly part of our database, but for the most part, we let ActiveRecord handle creating all the SQL for us as Cyril said. Unless you have some big, nasty ultra-normalized parts of your database, you shouldn''t need to write any SQL statements at all, just let your relationships in ActiveRecord work their magic. That being said, if in a particular instance, calling a stored proc is going to save you lots of time, refer to this page http://wiki.rubyonrails.org/rails/pages/StoredProceduresInMySql but as a general rule I would recommend against it. -Ryan On Jun 9, 7:41 am, Tyche <chandra.so...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > I am trying my hands on RoR for a dummy project and I use Mysql as my > database. For data manipulation and querying purpose, should I write > ruby code directly in active record or write a stored procedure and > invoke a call through active record? > I understand there are many advantages of stored procedures: > 1. They can help enforce data security. > 2.Amount of information sent over the N/W is less > 3. No compilation step is required to execute code > 4. Once the procedure is present in the shared pool, retrival from > disk is not required everytime different users call the procedure i.e. > reduction in disk I/O > > Many thanks, > Tyche--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---