2

I see that many people recommend not storing mp3 files as blobs. I did not get a clear explanation of why that is.

I have low traffic websites (10 hits a minute). So far I have stored image files in database tables as blobs. The only look up that I do on the image tables is based on a single primary key. The image rendering has not been terribly fast, but OK.

I now have a need to store music files. If I used the same mechanism as the images, it would be simpler. But I need to understand the implications of doing that.

I would appreciate some advice.

rpat
  • 279
  • 2
  • 5
  • 12
  • 5
    A lot of the points listed in [Storing Images in DB - Yea or Nay?](http://stackoverflow.com/q/3748) apply to storing MP3s as well – Pekka Sep 11 '11 at 10:53
  • Thanks for the link. I went through the article. There are arguments both for and against storing the files as blobs. But the arguments against the blobs are mostly performance related. There are instances where blobs may be OK. I would try the blobs and perhaps do some volume/stress testing just to see. – rpat Sep 11 '11 at 13:43

2 Answers2

4

Filesystems are meant for files, why wouldn't you store it there?

In MySQL it will be so much slower; you're saying 'it has not been terribly fast'. This will grow exponentially if load increases. You'll also likely need to load the entire BLOB into memory in PHP (if that's the front-end language you're using) which also causes issues.

Once you've done this, you'll especially notice it increases memory usage and the time it takes before the mp3 starts downloading/playing.

Evert
  • 93,428
  • 18
  • 118
  • 189
  • 1
    It was just easier to store images as blobs from the backup, access control perspective. I do appreciate you help. – rpat Sep 11 '11 at 14:18
0

BLOB is required for that but i think fetching the URL of mp3 song and then set as hyper link and to play a song in browser this code is necessary