0 Replies Latest reply on Jan 30, 2008 10:09 PM by Eric H

    Storing large objects in the DB?

    Eric H Novice

      My application allows users to attach images to many different objects in the DB. It also allows PDFs etc to be attached. These types of attachments are typically in the 100s of K, or maybe up to a couple of MB.

      I know that there are two camps on this. One, put attachments on disk as plain files. Two, store them in the DB.

      I personally like databases. I like everything I get with them, especially ACID. I like the idea of being able to back up my entire application state by backing up one thing, one thing that has excellent backup tools built in to it.

      However... I'm worried some about performance. I know that within JDBC, I can fetch LOBs as OutputStreams, so it can stream data out of the DB in an efficient way. Looking at the EJB3 docs, there is a @Lob annotation which handles the thing as a byte[] basically. Of course these can be fetched lazily.

      Does anyone have some views on the performance aspects of this? Should I go ahead and store everything in the DB, or is that going to kill this app if traffic goes up?

      I'll be using the Postgres database, if it matters.