On Jun 6, 2010, at 5:51 PM, Paul M Foster <pa...@quillandmouse.com> wrote:

On Sun, Jun 06, 2010 at 09:55:20PM +0100, Ashley Sheridan wrote:


Having said that, it's not generally a good idea to store images as
blobs in my experience. It can create slowdowns in database access, and increases the amount of space the db requires by a lot! What most people
do I've found is to store the image as a file and store the path and
filename to it in the db. However, if the location is going to change
often then it might be best to store it as a blob like you're doing.


Storing blobs in an RDBMS is an abuse of the technology, IMO. RDBMSes
were not originally designed to store this type of information, and as
Ash pointed out, it still can create problems. His assessment of the
preferred method for storing this type of information is spot on. Store
them in a file and then store the file location in your database.

I don't know, but this might be use case for the new generation of NoSQL
databases. I have very little knowledge of how they store data, but I
would assume they're more accustomed to storing blobs and whole
documents. And if not, then someone should come up with one which works
this way. It would be relatively simple to create a key-locaton table
(using dbm or somesuch) and have all the actual "data" stored in files.


Paul M. Foster

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

In my experience, most RDBMs fail at blobs and internally they still store it as a file with a pointer. It's also worthwhile noting that in all cases, after a certain size in the db is reached, performance is impacted. With mysql, it seems to be about 12gb and with SQL server it's around the 15gb size.

I had to write a script that would pull those images and store them on the file system and when run, it reduced the size of the db to about 1 gb in all instances, if not smaller. This dramatic change reduces back up time and costs, making the clients way happier since the performace also picked up.

As mentioned, it's just not worth storing in the db.


Sent from my iPod

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to