|The stupid question is the question not asked|
Re: Handling huge BLOB fields with DBI and MySQLby gmax (Abbot)
|on Mar 08, 2002 at 13:52 UTC||Need Help??|
Storing a large piece of data in a database is not always the best solution, but sometimes is the only thing you can do, so it's good to know that you can.
On the other hand, If I store something in a database, it's because I need to manipulate it. If I just store it to a database and then retrieve it without any additional benefit such as searching, counting, averaging, summing up, then I am just wasting my time and I should rather resort to FTP.
For my side, I don't like using filenames in the database and the data stored in files, because it adds one level of complexity to my system. Not to the uploading part, which could be actually easier, but to the maintenance business.
If I have everything in my database, I should take care of one thing only. All the system is in one place, for good and for bad.
I actually tried the filenames way and I found that it is not as practical as I want.
I noticed that by not letting the database dealing with the storage, some operations were even more complicated. For example, I need to guarantee the data integrity of my fields, and I do so by running a CRC function and comparing the results to other values stored in a table. I can do this with one single query. Not very practical to do with the files scattered in the filesystem. Or I need to calculate the total size of my fields, depending on the values of some other fields. All things that you can do if you have access to the server's filesystem, while the database can accomodate your needs with a simple call. Besides, you may want to store BLOBs that you need to search for. They could be documents, whose header you need to index. I can find so many advantages of having the data in a database, that I am very reluctant to the idea of relinquishing my possibilities to do so.
The difficult thing is only sending the data and fetching it. Apart from that, the rest of the operations are easier in a database than in a collection of files.I am not saying that the "filenames" solution is wrong. I just want to have it simple. For my needs, BLOBS are the right choice.
I am basically agnostic, so I won't try to convince anybody that what I am doing is the thing to do. Rather, I tell my reasons and I will welcome anybody who share my thoughts. I know that many people want to pursue the BLOBs choice but they have had technical problems. So I am offering my solution.
_ _ _ _ (_|| | |(_|>< _|