SQL

Shawn T. Rutledge rutledge@cx47646-a.phnx1.az.home.com
Wed, 10 May 2000 21:38:15 -0700


On Wed, May 10, 2000 at 08:49:07PM -0700, Austin Godber wrote:
> I've always wondered about this.  Do you actually keep the MP3s in the
> database or just a path to the MP3s?  I have recently collected a large
> number of text/ps/pdf and would like to somehow organize them where I
> could query Author, abstract, keyword, text maybe.  So would it be best to
> just include links or hold the actual files in the DB?

There is the concept of a "BLOB" (Binary Large OBject) which is a chunk
of binary data stuck into the database.  The name also correctly implies
that to the database, a "blob" is an unknown entity... you cannot do
queries based on the content of it.  But the Oracle admins I've 
talked to at my present job and the last one, all believed it was too
slow to be worthwhile; that it's faster to stick the file on the filesystem
and just store the path to it in the database along with whatever metadata.

I suspect that there are two possible implementations - one would be to
break up the file into reasonable-sized chunks (4K maybe?) and build a 
filesystem in a table... one column for the data, and another for a link
to the next record that has the next chunk.  Or, maybe the database 
just automates what you would otherwise do by hand - sticking the file
on the filesystem and storing only the path, but giving you an interface
which abstracts that away.  I'm not sure which databases use which 
approach.  I think we can be fairly sure that those which use the 
first approach end up being quite a bit slower than just storing the 
files on the filesystem.

But I haven't tried BLOBs myself yet.  I know that PostgreSQL supports
them.  (MySQL probably does too, but I'm not sure.)

When I wanted to insert pictures into Nettebook, I investigated and
found that there was no way with PHP to extract an image from a BLOB
and pass it on to the web browser directly; it would have to write it
to the filesystem first.  So I figured what's the point, managing multiple
temp files and figuring out when it's OK to delete them would be more 
work than just using files for the pictures in the first place.

-- 
  _______                   Shawn T. Rutledge / KB7PWD  ecloud@bigfoot.com
 (_  | |_)          http://www.bigfoot.com/~ecloud  kb7pwd@kb7pwd.ampr.org
 __) | | \________________________________________________________________
Get money for spare CPU cycles at http://www.ProcessTree.com/?sponsor=5903