As we all know, a design pattern that is used frequently in WordPress’ DB code is the idea of persisting data for a particular object (blog/post/comment), indexed with a particular name or key.
We see this pattern used in the following standard tables:
- wp_options
- wp_commentmeta
- wp_postmeta
As far as I can tell, the motivation for this design decision was to enable plugin/theme authors to persist data easily (e.g. by using custom fields) without having to modify the database schema. It would seem to me that there are few other advantages to this approach, since it is significantly slower and makes it harder to implement complex queries.
What are the other advantages to this approach, if any?
UPDATE:
Reading info on the drawbacks of this approach:
The ability to store abstract key-value pairs without modifying the database structure is the reason. Without that, WordPress loses much of its flexibility. I can’t speak for others, but the single largest reason why I develop atop WordPress is its flexible nature.
To quote one of your links above,
While it’s true that it forces queries to be more complex, and a little slower, the benefits far outweigh the costs. But, hey, it’s all about what you’re doing. Don’t use a hammer to bang in a screw. If you still want to use WordPress, but need to run complex queries on steady, structured sets of data, check out Pods.
I hope this helps you out!