BLOBs in the Database? Think again.

| 5 Comments | No TrackBacks

In response to a not-that-uncommon usergroup question:

 

Ah, I'm not a fan of putting BLOBs in the database--despite that it works better now-a-days. Adding BLOBs can easily fill up one of the smaller footprint DBMS systems like MSDE (2gb) and SQL Express (which can hold 4gb). There are a litany of other issues as well:

  • Performance. While fetch and retrieval performance has improved, it still takes longer to fetch a BLOB from the database and save it back than it does from a file (even on somewhere on a remote server).
  • Code issues: While it's easier than ever to fetch and save BLOBs there are still issues when writing code to deal with these special columns. There are special SQL requirements, DataReader settings and more.
  • Cache issues: When you fetch a BLOB, relevant data in the cache can be flushed along with procedures that need to be pushed aside to make space.
  • Backup/Restore issues: When you save BLOBs to the database, unless you partition off the segments of the database your backup includes the BLOB data. That might not be a bad idea unless the BLOB data is RO. In this case you needlessly store data that does not need to be backed up past burning the file to a DVD.
  • Object use issues: When you fetch a BLOB into a VarBinary or whatever object, you don't have it in a form that Word or any word processor can process. If it's a picture, you don't have it in a form that SnagIt Editor (very cool) can use. Sure, you can bind to a control, but invariably you probably have to write the value to a file first and then point another application at the file.  If the file is RW, once the file is on the client system you have to make sure it's re-persisted to the database somehow. Yes, SharePoint uses SQL Server to store the data in SQL Server. Question: do you plan to replicate this functionality? It's taken them years to get to this point.
  • Distribution. When you want to pass updated BLOBs to the client, you must upload the data to the database. In many cases customers have found it far easier to simply distribute the data via removable RO media (a CD or DVD). Some folks taking this approach have encrypted or otherwise protected the data files by adding security headers to the files so common image viewers won’t work.

As far as using multiple databases, I think you're making a lot of work for yourself and painting yourself into a corner. Yes, you can link servers and databases, but the mechanisms are not well understood or widely used. What you're describing is trying to solve the problem of delivering coal with a bicycle by using more bicycles.

 

I would address the issue of the file format instead of putting the data in a database. I suggest that you can write a security layer to encrypt the files, wrap them in a security blanket that would have to be unlocked with your application--this could be done far easier than by trying to wedge them into a limited capacity SQL Server database.

 

No TrackBacks

TrackBack URL: http://betav.com/blogadmin/mt-tb.cgi/1863

5 Comments

Bill,

Will you be @ the MVP summit? I'm really lookin' forward to meetin' ya !! :)

SM

Sure. I'll be the one wearing kevlar.

Kevlar? Man .. thats gotta be an internal joke I don't understand but need to ;)

Sahil obviously hasn't done any military service ;)

Like you say Bill, I have always stored pictures for example outside the DB and just stored a file path.. It just isn't a good idea in a disconnected enterprise environment to be shipping that amount of data around with its inherent problems.

Lennie,

I've spent all my life in an army atmosphere. :)

I know what Kevlar is .. just didn't understand why Bill should be wearin' it.

- SM

Leave a comment

Pages

Powered by Movable Type 4.21-en

About this Entry

This page contains a single entry by William Vaughn published on September 14, 2005 1:50 PM.

New Repository for VB Info -- http://vbfeeds.com was the previous entry in this blog.

Blobs in Database is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.