A
A
Algeorg2016-04-16 11:31:04
Database
Algeorg, 2016-04-16 11:31:04

Should images be stored in the database?

Situation:
There is an application for a local area network (written in Delphi, now it will be finished in Delphi). The application uses MS SQL Server.
There is a server (Windows) and mobile workstations (laptops under Windows). When the laptop is offline, the application must run offline (that is, SQL Server is installed on each mobile workstation). When the laptop is online, the application works with the server and its database.
The application contains images (in the future also videos, 3D models, etc.) in the amount of several thousand pieces and in the amount of several gigabytes.
Question:
Where to store images, videos, etc.? In a DB or separate files?
If files, then how best to organize synchronization when connecting a laptop to the network?
I rummaged through a lot of information on this seemingly button accordion topic, but I could not make an informed decision for our particular case.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
P
Peter, 2016-04-16
@petermzg

The file system is the same database. So store safely all images in blob database fields.
Pros:
- It will be more convenient to make backups (everything in the database)
- Data integrity is controlled
- Data access speed is comparable to the file system.

X
xmoonlight, 2016-04-16
@xmoonlight

If files, how best to organize synchronization when connecting a laptop to the network?
The Win environment has roaming profiles for this.
There is a mirrorfolder program: www.techsoftpl.com/backup/index.php
Can be configured to synchronize user profile folders by running on the server.
Can be done via SFTP+Delphi right in the application.
Where to store - depends on whether you want these files to be easily opened / edited without an application or not: if yes - then the database, otherwise - enough FS.

A
Alexander Skusnov, 2016-04-16
@AlexSku

I advise you to store in files, otherwise the database will greatly increase.

A
Andrew, 2016-04-16
@AndrewFoma

to be completely honest and frank, in the table in the field in the form of a bytearray, I have hundreds of thousands of files (images), it was not me who invented the base and its structure, and at first I thought it was bad, but now I see that it turns out to be very convenient, but when the data for the rest of the fields is indexed, everything is very fast even on an old server with a minimum load.
PS By the way, with an increase in the number of files that need to be stored, the speed of reading from the database will be faster than from the file system, this follows from the question: where to store files, if the files are not in the table, on the same partition (disk, raid?), then first, a link to the file is read from the database, then the file itself is read, and as the number of files increases, everything will definitely be slow.

A
Arexander, 2016-04-20
@fivec

there is such a Ukrainian IT-Enterprise system,
they store all attachments (pictures, documents, videos) in the database. At the same time, to save money, a separate database is used, for example, MS SQL Express. this simplifies maintenance of the underlying database. How much simpler this approach is ... but they really use it in all new versions of the system.

D
dexmay, 2016-04-28
@dexmay

Ms SQL for file storage supports technologies such as Filestream and File Table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question