storing mp3 files in mysql
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.
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.
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
精彩评论