Normally it is not a good idea to store large binary files in the database, it is best to save their location reference given the overhead, access speed, number of hits, file size, and the like.
Why store in the database:
- ACID properties are guaranteed, including making Rollback of a
update , which is very complicated when the information is stored outside of the database.
- The file always has a "Parent"
- Bank backup already ensures 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 size of the PDF you will have to do
a little magic = [
-
File management in the database is relatively more
complex than disk management and according to the number of data in the
need greater knowledge about classification of
files, indexes and the like.
-
File portability, because the PDF format is "universal", which
can not be said for DB's FileStream
-
Depending on the chosen bank the connection to upload and download
files may give a small headache to some problems already
known to each bank
-
If you upload to the Web, you have to implement a
FileStream handler and this takes much more time and knowledge
technical as well as being a failure factor
-
You can not use the cloud for possible scalability of the
system
I recommend creating the following scheme:
____________________________________________
| ID | TIME | QUERY | PDF_NAME | PDF_FILE |
|----|------|-------|----------|-----------|
Important to note that if you prefer to use a DB it is much more advisable to use FileStream than a Blob for performance reasons.
This reading will help you understand FileStream, Blob, and Varbinary
This is the SOURCE , but I changed some concepts for your purpose =]
Edit : Oracle uses BFile as type and not FileStream