in reply to Well Designed RDBMS
If you are only going to query the attributes rarely and want flexibility, personally I woud probably use a seperate table.
The main table would have something to uniquely identify the blob and the other table would be like:
create table attribute_table ( blob_uni int, attribute text, value tex +t ); create unique index a_t_uni on attribute_table ( blob_uni, attribute ) +;
If I were going to have a lot of attributes or they were going to have long names, I would make a 3rd table with attribute_id and attribute_name then use the attribute_id in the attribute_table. Also a varchar field may be handy instead of text on the attribute name field if a combined table is used.
When a lookup by attribute is wanted would be the only time this table is referenced and also it will be a fast lookup and much cheaper than a LIKE on a sizeable piece of text. The unique index will speed this up and prevent duplicate attributes of the same kind on a single blob.
select * from blob_table where id IN ( select blob_id from attribute_t +able where attribute='color' and value='red );
This design doesn't require the attributes to be known at design time and they can be added or removed at any time and attributes which do not apply to a given blob use no space at all.