0

I need to store large file (around 1Go) on my data warehouse. To explain the global contexte simply : the user selects some options in a webview and sends it to the middleware. The middleware uses these informations and sends new ones to a factory. The factory creates the 1Go file. Now I need to store it on the data warehouse in order to be download later by the user.

I use the framework django for the middleware and the factory is programmed in python.

So my question is : for this size of files, is it better to store it on a blob field on a database ? Or is it better to store it directly on the file systeme ?

neli
  • 15
  • 7
  • This [question](https://stackoverflow.com/questions/11438486/database-blobs-vs-disk-stored-files) includes some of the pros and cons of the file system vs blobs. – David Rushton May 24 '17 at 08:25
  • Possible duplicate of [Slowness found when base 64 image select and encode from database](https://stackoverflow.com/questions/41228496/slowness-found-when-base-64-image-select-and-encode-from-database) – e4c5 May 24 '17 at 16:28

1 Answers1

1

Storing you blob in database using a BinaryField will harm the performance of your application as your querysets will have to handle a lot more data. Best practice is to store blobs in separate files and only store the file path - using models.FilePathField() field - in your database and serve the actual image as static file. See this post for more details.

doru
  • 9,022
  • 2
  • 33
  • 43
  • Thank you very much. I go see your solution straight ahead. I'll validate your answer tomorrow in order to see if i can get other opinions. But thanks :) – neli May 24 '17 at 09:07