Should I store big files in BLOB fields, or outside of database?


If your main concern is whether Firebird can handle big blob data or a lot of blobs, than don't worry - there are real world cases with hundreds of thousands of big files stored in BLOBs. Keeping blobs in database is better, here are the reasons:

* it makes it easy to do backup and restore

* aviods the need to keep the database and disk directory in sync - which can be tricky if someone (beside your application) is allowed the directory access

* simplifies the true client-server applications, since file transfer is done by Firebird - just like other data and you don't have to implement some other file transfer protocol (FTP, Windows networking, etc.). This is especially important if application works in distributed environment with many network layers (firewalls, switches, routing, etc.) in between.

* removes the need for users to keep the file names unique


There are some potential drawbacks, but are easily worked around:

* longer time to backup and restore (with new nbackup tool, it's as fast as regular file copy)

* web applications can serve files (images/video) directly from the disk (a wrapper that extracts the same from database is trivial to write in any web language - usually only a few lines of code - and both have to be read from the disk anyway, so there's no performance penalty)

* ability to view files directly from other applications (while this is nice, it is also a potential trouble-maker as other applications can change or delete the files without database knowing about it)


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous