What is faster for searching in a MySQL database, key-attribute table or XML form data column?



We have user built forms where the data entered by them is "serialized" to XML when stored in the database. So 100 forms (with X fields) are 100 rows in the table:



| id | form_id | data_xml |


If we use a key-attribute table, 100 x form with 10 fields = 1000 rows:



| id | form_id | field_id | data |


What is faster for searching (in MySQL terms, innoDB and MyISAM)? For example we want to find all forms where field age is < 50, or where field gender = male, etc.


I thought the first method would be faster but I think each row would have to be unserialsed and processed. The next method would need joins and some data convertion?


No comments:

Post a Comment