In a typical wordpress site, there are some tables which are named with the “meta” in the end. In these tables there are 2 columns, one named “meta_key” and one named “meta_value”. There are stored any kind of variables.
Isn’t it a bad design? What are the benefits of this design and what are the flaws?
It all depends on the outer design – key value tables are just another way of storing data, just another way of thinking. Just like NoSQL.
You have to look into how wordpress uses these tables. I can’t say much about wordpress since I’ve never delved into the database schema. The code I have checked out for fun but nothing spectacular.
On the other hand, Magento also uses key value tables in some parts and its working great for that particular design. Not that I’ve ever used the beast.
In my experience, I’ve come to to the conclusion that actual entities in the design have there own table all to themselves while things like configuration data can be put in one tall thin table.
It’s good to be lazy but not to lazy.
One other thing to ponder is having an extra column of information (apart from the id if you use it) for the key value table. Call it say ‘relationship’. Heres a good start for this kind of thinking (don’t fret to much over it since its a deep rabbit hole with strange creatures):
http://en.wikipedia.org/wiki/Resource_Description_Framework