Hello,

How could I store a flexifield with 3 fields for example serialized in a single field?

Currently CCK would create a separate table for this group and store it in a table with 3 columns per instance.

Any tips please?

Comments

IncrediblyKenzi’s picture

Serialization is expensive.. is there a reason you want to serialize? It's likely to be significantly faster to fetch data by individual data elements in the field if they're stored in separate database fields.

giorgio79’s picture

Serialization may be expensive for php, but inexpensive for the db.

The way CCK currently stores multi value fields (which method is used by flexifield as well) is that it stores these fields separately in their own table, which is expensive for the db.

I went around this issue by saving serialized stuff in a CCK Computed field inside the main content type talbe. (http://drupal.org/node/782974)

I dont like JOINs on production sites with large tables, and this way I wont have to pay for a db admin down the road.

IncrediblyKenzi’s picture

JOINs are significantly cheaper than trying to do a substring query against a field.. No index except a FULLTEXT will allow you to do so, and that requires that you abandon innodb (which introduces other problems). If you don't foresee ever having to query against the individual values stored in that serialized field, then I say serialization is fine, just be forewarned that refactoring that after the fact could be a bear.