I have a site which is basically a catalog of product about 30,000.00 products. What do you think is the best (in terms of performance) way to keep track of the most popular products,a part from the idea of writing web-server log parser. I''m thinking of creating a model called ''product_view'' which has product_id & view_counter, and updating this table in product#show. -- 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 -~----------~----~----~----~------~----~------~--~---
You could just keep it in memory if accuracy isn''t very important. On Sun, Jan 11, 2009 at 7:00 PM, Mohammad Abed < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have a site which is basically a catalog of product about 30,000.00 > products. What do you think is the best (in terms of performance) way to > keep track of the most popular products,a part from the idea of writing > web-server log parser. > > I''m thinking of creating a model called ''product_view'' which has > product_id & view_counter, and updating this table in product#show. > -- > 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 -~----------~----~----~----~------~----~------~--~---
I think I might look into this http://playtype.net/past/2008/2/6/starling_and_asynchrous_tasks_in_ruby_on_rails/ On Jan 11, 7:39 pm, "James Englert" <englert.ja...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You could just keep it in memory if accuracy isn''t very important. > > On Sun, Jan 11, 2009 at 7:00 PM, Mohammad Abed < > > > > rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > I have a site which is basically a catalog of product about 30,000.00 > > products. What do you think is the best (in terms of performance) way to > > keep track of the most popular products,a part from the idea of writing > > web-server log parser. > > > I''m thinking of creating a model called ''product_view'' which has > > product_id & view_counter, and updating this table in product#show. > > -- > > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Popular in terms of viewing or selling? Why don''t you keep a counter in the DB? Cheers, Sazima On Jan 11, 10:00 pm, Mohammad Abed <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have a site which is basically a catalog of product about 30,000.00 > products. What do you think is the best (in terms of performance) way to > keep track of the most popular products,a part from the idea of writing > web-server log parser. > > I''m thinking of creating a model called ''product_view'' which has > product_id & view_counter, and updating this table in product#show. > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mohammad Abed wrote:> I''m thinking of creating a model called ''product_view'' which has > product_id & view_counter, and updating this table in product#show.This sounds like a fine plan, but does it provide any advantage over simply adding a view_count attribute to your product model? In either case you must update the database on every product view. Putting the column right on the product model seems to be a simpler solution to me. This way you don''t have to mess with any model associations. Having a separate table to store your counts would, technically, be a more efficient use of disk space. But, as you said you expect around 30,000 products. This is a pretty small number in the grand scheme of things so I wouldn''t be worried much about the extra space one more integer column would take. Certainly not enough to warrant the addition of a separate model. -- 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 -~----------~----~----~----~------~----~------~--~---