Which is the most correct way to store files

Asked

Viewed 161 times

1

I always run into this question when I have to work with file storage inside a software.

  • It is ideal that I simply record them in any folder and record the information in the database, with a field pointing to the path where the file is?

  • Or it is more feasible that I create a "file" field and convert the bytes of this file, thus centralizing all my storage in the database?

In my case it is more specifically '.mp3' and '.mp4' files that are sent to the user via streaming.

As the files can become quite large, I think this can be a problem when storing directly in the bank and so the first option becomes more viavél, but in other cases, there is some case that I should/ can store in the bank?

The question How to model a tree data structure using a relational database? covers the subject well, but for me it is still not very clear this issue of file size, and whether they can somehow affect the performance of my bank

  • 2

    The question is different from the other two... and why I can’t answer?

  • 2

    If I open the answer, I turn it into one: The answer is depends on each case, there is no right way and there is no wrong way. A study by a Microsoft staff (https://www.microsoft.com/en-us/research/wp-content/uploads/2006/04/tr-2006-45.pdf) concluded that, in their test, up to 1 MB was worth keeping in the bank, and above that in the file system. as in your case are large files, probably will perform better using same files, and in BD store only meta data, beyond the file path.

  • Something similar for example that Wordpress does

  • @Dudaskank, the question has been closed and is being voted to be reopened. While it is as [duplicate] no changes can be made. Read more about: https://answall.com/help/duplicates

  • @Uzumakiartanis I can vote for?

  • Can you vote? No. Only people with more than 3,000 reputation points and moderators. @Dudaskank

  • Does any of the current 3 links you have upstairs answer your question? Even if the questions there are not exactly the same, the answers solve your problem?

  • Clearly @bigown marked correctly, reading the question and seeing the corresponding posts is possible to come to a conclusion for the "problem" and with that solves the problem of this question.

  • 1

    Yes, the links helped solve the problem

  • 1

    @Everson He (bigown) had closed pointing to the wrong place, was correct well after. Part of the confusion here was because of this.

Show 5 more comments
No answers

Browser other questions tagged

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