amrkamel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-09 08:19 UTC
Best way to store binary data
Dear all, can any one tell me what is the best way to store binary data "e.g. images, videos ...etc" of various sizes in a ROR application? should I store them in mysql database or in file system? Thanks alot :) in advance.. Amr M. Kamel --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
U can store the binary data in mysql database. i think it is a best way(suppose u have lak of lak image db volume will be huge, but i think thats not big problem). Mohan On Mar 9, 1:19 pm, "amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Dear all, > can any one tell me what is the best way to store binary data "e.g. > images, videos ...etc" of various sizes in a ROR application? should I > store them in mysql database or in file system? > Thanks alot :) in advance.. > > Amr M. Kamel--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
amrkamel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-09 08:56 UTC
Re: Best way to store binary data
Thanks alot for your very fast reply, and for database volume we can always solve it by adding extra hard disks and maybe use one of RAID technologies :) Thanks again. On Mar 9, 10:29 am, "mohan" <mohan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> U can store the binary data in mysql database. i think it is a best > way(suppose u have lak of lak image db volume will be huge, but i > think thats not big problem). > > Mohan > > On Mar 9, 1:19 pm, "amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Dear all, > > can any one tell me what is the best way to store binary data "e.g. > > images, videos ...etc" of various sizes in a ROR application? should I > > store them in mysql database or in file system? > > Thanks alot :) in advance.. > > > Amr M. Kamel--~--~---------~--~----~------------~-------~--~----~ 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 9 Mar, 09:29, "mohan" <mohan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> U can store the binary data in mysql database. i think it is a best > way(suppose u have lak of lak image db volume will be huge, but i > think thats not big problem).it''s a way, but it isn''t the best. databases will grow in size, creating problems for portability, backup dumps and speed. if you have a small amount of data storing binary data in database seems a good idea, for every other thing fs is the way to go, at least for me. --~--~---------~--~----~------------~-------~--~----~ 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 don''t think it is a good idea. I can''t think it would be any better than saving the actual files. Having to pull images out of the database will probably add dramatically to database bandwidth over time. Probably the only advantage is that saving to database is probably easier to do; requires less code. I personally choose to save the actual files to the file system and store info about the file (width, height, filesize, md5, etc) to database. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
amrkamel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-11 13:24 UTC
Re: Best way to store binary data
Thank you all for your help :), Eleo, I like your idea but I should add also a column that stores file location on the file system "as a pointer" to be able to fetch the file? is this correct? or if there is a better approach plz let me know it.. Thanks alot. On Mar 9, 11:56 am, "Eleo" <SirE...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I don''t think it is a good idea. I can''t think it would be any better > than saving the actual files. Having to pull images out of the > database will probably add dramatically to database bandwidth over > time. > > Probably the only advantage is that saving to database is probably > easier to do; requires less code. > > I personally choose to save the actual files to the file system and > store info about the file (width, height, filesize, md5, etc) to > database.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s one way. Another is to setup some convention whereby you can calculate the file location based on the record ID or some other signifying data point in your model. This''ll make it easier to scale if you need to in the future. On Mar 11, 9:24 pm, "amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thank you all for your help :), > Eleo, I like your idea but I should add also a column that stores file > location on the file system "as a pointer" to be able to fetch the > file? is this correct? or if there is a better approach plz let me > know it.. > Thanks alot. > > On Mar 9, 11:56 am, "Eleo" <SirE...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I don''t think it is a good idea. I can''t think it would be any better > > than saving the actual files. Having to pull images out of the > > database will probably add dramatically to database bandwidth over > > time. > > > Probably the only advantage is that saving to database is probably > > easier to do; requires less code. > > > I personally choose to save the actual files to the file system and > > store info about the file (width, height, filesize, md5, etc) to > > database.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
amrkamel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-11 14:52 UTC
Re: Best way to store binary data
Dear Eleo, thanks for your fast reply but can you elaborate more "if this doesnt bother you, I am a NOOB :)"? thanks agin. On Mar 11, 4:17 pm, "eden li" <eden...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That''s one way. Another is to setup some convention whereby you can > calculate the file location based on the record ID or some other > signifying data point in your model. This''ll make it easier to scale > if you need to in the future. > > On Mar 11, 9:24 pm, "amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <amrka...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Thank you all for your help :), > > Eleo, I like your idea but I should add also a column that stores file > > location on the file system "as a pointer" to be able to fetch the > > file? is this correct? or if there is a better approach plz let me > > know it.. > > Thanks alot. > > > On Mar 9, 11:56 am, "Eleo" <SirE...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I don''t think it is a good idea. I can''t think it would be any better > > > than saving the actual files. Having to pull images out of the > > > database will probably add dramatically to database bandwidth over > > > time. > > > > Probably the only advantage is that saving to database is probably > > > easier to do; requires less code. > > > > I personally choose to save the actual files to the file system and > > > store info about the file (width, height, filesize, md5, etc) to > > > database.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---