File storage, database or disk?

Asked

Viewed 2,803 times

1

I am developing an intranet system, with a file storage module (exclusively PDF).

What you tell me about the storage location, save to disk on the server or in a database?

Remembering that it is an intranet. The server is on the same network, and the database is ORACLE. Both "backupeados".

If possible argue the choice (In question of performance, data security, etc)

  • 3

    See if the answers here resolve your doubt: https://answall.com/questions/12687/

2 answers

3


Normally it is not a good idea to store large binary files in the database, it is better to keep the reference of their location given the overhead, access speed, number of accesses, file size and the like.

Why store in Database:

  • ACID properties are guaranteed, including making Rollback of a update, which is very complicated when the information is stored outside the database.
  • The file always has a "Dad"
  • Bank backup already ensures that binaries will be saved

Why save to Disk:

  • The size of binary files varies for each database when if Filestream is used, depending on the PDF size you will have to do a little magic =[

  • File management in the database is relatively more complex than managing on disk and as the number of data on a greater knowledge of the files, indexes and the like.

  • File portability as the PDF format is "universal", which cannot be said for DB Filestream

  • Depending on the bank chosen the connection to upload and download files can give a small headache to some problems already known to each bank

  • If an upload is made to the Web, you have to implement a Filestream Handler and this takes much more time and knowledge technical as well as being a factor of failure

  • You cannot use the cloud for a possible scalability of system

I recommend creating the following scheme:

____________________________________________
| ID | TIME | QUERY | PDF_NAME | PDF_FILE  |
|----|------|-------|----------|-----------|

Note that if you prefer to use a DB it is much more recommended to use Filestream than a Blob for performance reasons. That reading will help you understand Filestream, Blob and Varbinary

That’s the SOURCE, but I changed some concepts for its purpose =]

Edit: Oracle uses Bfile as type and not Filestream

  • Thanks Matheus, I really have a tendency to save on disk. I’ve implemented something like this once, but without knowing much about why. His reply clarified quite a few doubts he had.

-1

Hello,
Software performance is equal in both cases according oracle in the text also shows about the various ways to display or load files from the database.
It depends much more on how much performance your machine has to process the data.
I like to put it in separate file and keep only the file link in the database.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.