0

I am developing an application in JSF using PrimeFaces. I have now come to a part where I want to provide uploading pictures (jpg, png, ...) for the user to use them in reports he writes.

I believe the normal way would to save them in some folder on the server. But I would prefer to save them to the database (MySQL or Oracle) as I find it easier to manage.

Do I have to face performance issues doing that? Or is this fully ok and just a matter of personal taste?

Socrates
  • 8,724
  • 25
  • 66
  • 113
  • 2
    It's purely a matter of opinions. There's very few usage cases that call/require for in-db images, and a great many usage cases where in-db images are a bad/painful idea. – Marc B Nov 07 '14 at 16:58
  • 1
    How big can these pictures get (kB, MB, ...)? – lurker Nov 07 '14 at 17:00
  • Based on your number of files that you will save. if Millions images, it is best to go for Data Centers. If tens of thousands go for a big space in servers. If only hundreds go for a DataBase. – madhu_karnati Nov 07 '14 at 17:06
  • 1
    I think the smallest pictures might be around 100kB and the biggest ones around 10MB. Ok, same question the other way around: What exactly would be bad in putting them to the database? Even though many people say that it is "not good", I still have a great lack finding out why. There are many ways to store binary data into many different databases. So why not do it then? – Socrates Nov 08 '14 at 06:59
  • IMHO it really depends on the case. This is a good question though for clarification. I see a big advantage in storing them in the database. Especially when it comes to backups with SQL dumbs, it is much easier to have 1 place to backup, instead of many different. – Melauki Mawi Dec 17 '14 at 06:13
  • On the other hand, performance is lower when storing in the database. The head will be bigger, while the file is still the same. So you have to decide between better performance or better usability. – Melauki Mawi Dec 17 '14 at 06:15

2 Answers2

0

I think it would be best for you to store them as what they are: files. MySQL is not made for large entries, and pictures are generally large files.

0

Answer is simlply NO.
Obviously database access performance when you deal with binary large objects is degrading, and the database dimensions will grow a lot, causing again performance loss... and normally database space is much more expensive than file system space.

Sagar Pudi
  • 4,634
  • 3
  • 32
  • 51
  • Thanks for the answer. I still have a question though. Why would database space be more expensive? Most web spaces I bought in my life had a combined space for database and file storage. For instance 5GB in total for both. Or if you take a virtual server, then maybe 200GB in total. – Socrates Nov 08 '14 at 07:02
  • Retrieving an image from a database incurs significant overhead compared to using the file system. – Sagar Pudi Nov 08 '14 at 10:41