I need to store Mp3 files in a Database.

Problem is that the files are going to be accesed with a smartphone. As the Smartphone is going to need to decode the Blob it would be very slow.

I tried already to do this with a MariaDB but discovered that the data was stored as a Blob...

Im asking for a way to store the files in a Databank without changing the format. If there is one Please enlighten me!

  • 2
    Why would the smartphone need to decode a blob? Will it access the database directly? an mp3 is going to be binary anyway. I'm not sure what you are asking here. – Tom V Nov 22 '18 at 8:07
  • It would be going to acces the database directly using a Querry stored in a QR-Code – gratefullNoob Nov 22 '18 at 8:10

Some databases can store blobs in the filesystem, but managing it by records in the tables.

MySQL/MariaDB can't.

Typically, the closely coupled recordset structure is a very alien structure from the storage of files, particularly if you have large ones and many of them.

My experience is that it makes the db maintenance costs and performance costs too high. Backups will be slooow, the db starts to become buggy, it will be more vulnerable for crashes, and it will perform very badly, compared to a dual "files in a directory managed by records in the db" structure.

If you want a good performing application, then there is no free lunch, you need to develop it. It is not a big overhead, essentially, instead the blobs, you will have filenames.

There is also the option to serve these files directory by your webserver, without involving the backend (which is tuned probably for complex tasks with small strings, and not for the primitive, but super-optimized http serving of large files).


There is probably no way to have a binary piece of data (file) stored in a database (either relational or non-relational, NoSQL, that is) as "not blob" and without any need to decode it at the same time.

  • If you don't want to decode it, store it as a BLOB.
  • If you don't want to store it as a BLOB, store it as a CLOB and then decode it.
  • If you want neither of the above, consider another means of storage
  • Accessing a database directly from "outer world" is generally a bad idea.

Not the answer you're looking for? Browse other questions tagged or ask your own question.