# Blobs for property bags

**URL:** <https://forums.percona.com/t/blobs-for-property-bags/817>\
**Category:** Other MySQL® Questions\
**Created:** [June 27, 2008, 12:59pm UTC](https://forums.percona.com/t/blobs-for-property-bags/817 "2008-06-27T12:59:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jjhuff](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@Jjhuff](https://forums.percona.com/u/Jjhuff)\
**Post date:** [June 27, 2008, 12:59pm UTC](https://forums.percona.com/t/blobs-for-property-bags/817/1 "2008-06-27T12:59:20Z")

</div>

In several places we want the ability to store a ‘property bag’, i.e. a set of key:value pairs for some object (like a file or user). We don’t query or sort on their values.

One option is to do something like:  
CREATE TABLE file\_properties (  
nFileId BIGINT NOT NULL,  
strKey VARCHAR(64) ASCII NOT NULL,  
strValue VARCHAR(512),  
PRIMARY KEY (nFileId, strKey)  
) ENGINE=InnoDB CHARACTER SET utf8;

The other:  
CREATE TABLE file\_properties (  
nFileId BIGINT NOT NULL,  
blobProps BLOB,  
PRIMARY KEY (nFileId)  
) ENGINE=InnoDB;

Files typically have 6 or 7 props and are typically write once, ready many. We also have a cleanup process that deletes these in batch jobs. In the BLOB approach, we’d probably store things as a pickled (and probably compressed) python dictionary.

What do people think? Is there an obvious winner here?

thanks!!
