storing heterogeneous json objects in same MySQL table? -


what recommended way of storing heterogeneous json strings same mysql table? i've got other tables in mysql database store information other json objects, store these json objects in same db in best recommended way.

i want store json strings perl script mysql table not won't have same values, have different hierarchical structures in different json objects. considering storing them either strings or blobs, minimal metadata each entry. e.g.:

create table `entry` (   `entry_id`               int(10) unsigned not null auto_increment,   `file`                   varchar(1023)    default null,   `json`                   blob             default null,   `update_timestamp`       timestamp        default current_timestamp,    primary key (`entry_id`) ) engine=innodb auto_increment=1 default charset=latin1; 

are there tools or libraries should consider before straight on perl , mysql? wonder if there out there reverse of dbix::json select queries mysql...

json objects in db fine until don't want query content of it.

the storage type worth discussion. compress either whole row in innodb ( row_format=compressed key_block_size=8 ) or doing in application compressing json , put in binary format.

with first option (application handles text, mysql handles compression) prefer json column text type (text, longtext, mediumtext, tinytext).

with second version (application handles compression, mysql sees binary) of course use blob format (tinyblob, blob, mediumblob or longblob).

both valid options. depends on personal priorities. moving compression application benefit of scaling easier introduce complexity. let mysql take care of compression transparent , easy setup puts pressure on cpu (which way bottleneck databases).


Comments