Ok so im fairly new to wordpress programming and realized all their core data, and plugin data are always serialized. Doesn’t this take away from the RELATIONAL aspect of a RDBMS? And it doesn’t even save space because the strings are soooo long most of the time, and it’s harder to scale/modify the data this way…
I don’t understand why they decided to do this, and i haven’t found any online references as to why they would do this.
Obviously, since I’m not a developer for WordPress, I don’t know their exact reason.
But perhaps they came to the same conclusion as me:
Sometimes, it’s just not worth it. Sometimes, you just want to store some data. Sometimes, the database will never, ever do anything with that data other than send it back to the processing code. In cases like this, when the data will never relate to anything else in the database, why bother designing a relational database when a data-dump is all you need?
Is it a good idea? Probably not, it’s a lazy one that just works when you need it to with a minimum of fuss. However, if I ever catch you using MySQL to try and process data out of a serialised column, I will ban you from the internet.
Serialization :
A PHP array or object or other complex data structure cannot be transported or stored or otherwise used outside of a running PHP script.
If you want to persist such a complex data structure beyond a single run of a script, you need to serialize it.
WordPress core and third-party plugins often serialize arrays or objects as a way of storing structured data in the WordPress database.
Data serialization in order to improve performance or efficiency in a database. Instead of creating a new table for data,
or storing data in a table which could end up having wasteful empty fields, you can keep all the data in an array in one field.
This leads to saved space and simplified SQL statements. Serialized data is stored and recovered using PHPâs serialize() and unserialize() functions.
I think serialize data is wordpress feature in which developer can store data and enhance functionality with out comsume more space and effort and use up to end level.
There are disadvantage for serialization in which,
you canât run a MySQL query on serialized data.
The data would have to be pulled out of the table via PHP, unserialized, and then searched using PHP instead of MySQL
In data portability you can not do simple search and replace procedure and change site URL stored by widget or plugin,Its better to use WordPress Search and Replace Tool or WP Migrate DB for complete data migration which are stored by serialize procedure.
Because they haven’t really changed the architect too much. This makes it backward compatible with older versions of WordPress which are also compatible with old versions of MySQL and PHP.
As a long-time developer with lots of experience with many different CMSes and MVC frameworks, I can say they’re idiots for using serialized data and should have used JSON.
It’s a shitty decision, but it also can be respected.