![]() |
what kind of data can go into a mysql database?
can huge zip files or .img files go in?
or is it best to put things like images etc. |
anything can go into a mysql database if you use blob
|
do people usually insert files into their database or just trow it into a upload directory?
|
Upload directory in tangent with databse to keep the the path to the files, megaupload does this.
|
Never store files in mysql, its not mysql's purpose. You store the files as files on your hard drive (where it belongs) and the links to them in the database if need requires.
|
If databases weren't meant to store binary data, why do we have the BLOB column type available? There are strong arguments for and against on both sides of the argument, though often the strongest side tends to be to store the files in the file system and make a reference to the file name and/or path using a simple VARCHAR column.
|
Databases store infinite amount of data.
And that data can be anything. I think that vBulletin stores avatars in blob field types. :] |
I'm interested. How does vBulletin store that data? Is it the same if I open an .JPEG image with notepad?
|
Quote:
|
Quote:
http://www.talkphp.com/avatars/orc.gif |
Quote:
|
Quote:
The files aren't duplicated or created from the original, cause I looked all over in vbulletin. I dunno, check the dump |
If I had 10,000 2k images/files, I'd probably store them in the DB. If I 1000 100k files, I'd probably put them on the filesystem.
As for the vBulletin thing, vB has support for storing attachments, sig pics, profile pics, avatars and thumbnails in the database using Blob columns. Alan |
Quote:
|
interesting,
now can someone explain why type of php code inserts an image uploaded into the db thanks wow i have so much gas, the smell is strong |
Quote:
|
Google turned up a quick example
Uploading Files To MySQL Database Using PHP and Ork was right...the last comment wasn't needed. |
One of the benefits of using a database system over the file system to store files is to overcome throughput issues.
Having directories of millions of files for example can kill IO throughput. Databases can overcome this because usually they use a single table space. Not to mention they have sophisticated data caching methods. But do remember, a file system was designed to store files, so in the majority of cases it is advisable to use it. |
So the most likely conclusion is to store small types of binary data in the database, like documents and small images, but store files of great size, like say 100MB or maybe 1000MB (1GB) on the filesystem.
|
There is a significant amount of overhead when using the BLOB field type for storing much of anything last i knew :S
|
| All times are GMT. The time now is 11:44 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0