[Cialug] 2Blob || !2Blob

Zachary Kotlarek zach at kotlarek.com
Sat Oct 8 20:19:06 CDT 2011


On Oct 8, 2011, at 5:01 PM, Kevin C. Smith wrote:

> Any thoughts on the subject of storing binary data in an
> RDB (PostgreSQL in this case)?


The pros:
	Atomicity, integrity, etc. -- all the stuff you expect from an RDB
	Keeps all your data in one place, so it's easy to back up or migrate
	Can use DB permissions to control access (can be important in shared hosting)
	No need to synchronize with or teach your program about the filesystem

The cons:
	Poor space efficiency
	DB is loaded to do filesystem things
	Need to be careful to avoid slowing down normal queries (ensure your DB engine/indexing/partitioning keeps blobs separate)
	Slow file access compared to the normal file system
	No way to manipulate files out-of-band

IMHO there's no hard rule one way or the other. If performance and space efficiency aren't big concerns using the DB can make things easier just by keeping everything in the same bag. But there are advantages to letting the file system do things the file system is good at, as long as you're prepared for the increased effort required to maintain synchronization among the DB and file system.

	Zach

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2746 bytes
Desc: not available
URL: <http://cialug.org/pipermail/cialug/attachments/20111008/6a9030c9/attachment-0001.bin>


More information about the Cialug mailing list