BLOBs storage in a dedicated table

bloboracleoracle-11g-r2

I have a database that has several BLOB columns scattered across multiple tables. Since I am a developer and am looking at making application code writing easier, I wanted to turn these columns into NUMBER FK columns referencing a table dedicated to BLOBs only (i.e. a PK ID column and a BLOB column). This would allow our ORM library to do lazy initialization of objects much more easily with less code.

What are the performance or data organization implications to doing this? The database is quite large in size due to these BLOBs.

Best Answer

Generally, if you move a BLOB column to another table, and the new BLOB column has the same attributes (such as "DISABLE STORAGE IN ROW", see my other answer), performance wouldn't change much. How Oracle internally stores LOB/BLOB/CLOB columns is, as I understand, not relevant to you, as your question deals more with the user-visible data model.

One obvious performance implication of using a foreign key is that it slows access down a little bit.

But throwing multiple BLOB columns into a single column is a very bad idea in terms of design. Although I don't know Hibernate ORM, to me your question sounds here as "Is it a good idea to spoil the design of database to fix a problem with Hibernate?". Well, it's not a good idea.

What if you need to export or import blobs referenced from only one of your tables?

How would you partition your blobs if they are in a single table? (If your database is "large", you need to plan for that already!)

What if the BLOB updates/inserts that were concurrent previously, now get serialized because you have a single BLOB column?