Many database applications must face the issue of unstructured data storage, which is often critical to the entire system. Therefore, we need a suitable solution that takes performance, security, stability, and other factors into consideration. This article briefly describes the implementation scheme of the application system that uses SQL Server and Oracle as the database management system (Note: personal opinion only ).
There are actually two implementation methods:
1. Use a file system to store files and store the access path in the database. This method is easy to implement and does not require advanced DBMS functions. However, this method cannot implement transactional access to files, which is not convenient for data backup and recovery and data migration;
2. Use the DBMS file storage function. Common methods, such as filestream/BLOB in SQL Server and bfile/BLOB in Oracle. This method overcomes the shortcomings of implementation method 1, but requires the support of DBMS. That is to say, the control of this method is in the hands of the DBMS vendor. The good and bad DBMS implementations are good, but bad. The most important thing to consider in this way is whether operations on unstructured data directly or indirectly through DBMS will generate too many Undo/Redo operations and affect the performance of the entire system, will it reduce the system concurrency.
My personal point of view is that method 1 is suitable for scenarios with low-cost storage, transaction access, backup, and other small-or ultra-large files (several hundred MB) stored, in other scenarios, method 2 is more suitable.