[Courses] (no subject)

Cynthia Kiser cnk at ugcs.caltech.edu
Wed Nov 21 20:32:10 UTC 2007


Quoting sbl <witchyway at mac.com>:
> Is using a database to store the pictures a good way to go - there
> are only a finite number of cards to scan? What format for the
> pictures.  What about storing small audio files in a db? Or should
> you use the database to catalog the info and a file path to it but
> not actually store it within the database? Are there other built-in
> database functions that will ease the front end programming and keep
> it slim and faster by using native functionality?, etc.

There is often discussion of the trade offs of storing large objects
in a database (as BLOBs or CLOBs)* vs. storing the object itself in
the file sytem and only keeping the file system location in the
database. The usual assertion is that for web apps it is faster to
serve files out of the file system - but I haven't seen hard numbers
from anyone benchmarking this. For sites the size of what I generally
support, the ease of management of having the files in the database
usually outweighs the performance consideration (that is, pulling
images out of the database is fast enough for my sites). The usual
list is: 

Pro:

Transactional - the file gets into the db or the insert is rolled back 
Backups - you just back up the db, not db + section of the file system
	- ditto for moving a site to a new machine, just transfer the db


Cons:

Slower - but not sure by how much. Tuning your space allocation
       parameters so the object is stored all in one piece can help
       mitigate slowness because of the database layer
Harder to manipulate the files outside the db. I can't just tar up my
       image_upload directory and send it to my graphic artist; I
       would have to write a script to dump the db images to a
       directory and then tar that up. 

I read the wikipedia article sent out last night and am interested to
know what TOAST is and whether that eliminates speed as a
consideration. http://en.wikipedia.org/wiki/Postgresql#Other_features 


* BLOB = Binary large object
  CLOB = Character large object

-- 
Cynthia N. Kiser
cnk at ugcs.caltech.edu




More information about the Courses mailing list