known icon indicating copy to clipboard operation
known copied to clipboard

Metadata Tables?

Open mediaformat opened this issue 1 year ago • 1 comments

Issue description

Currently, with MySQL there are tables such as config, entities, reader, site which also have their own *_metadata table. The Entity data is JSON encoded within the contents column, but all of that data is also repeated in the entity_metadata table, with rows sharing the _id of the Entity and the data presented as name, value pairs.

I'm curious as to why it's organized this way? Was this was a way to handle json before mysql added json methods, or if there is a performance benefit?

mediaformat avatar May 21 '24 21:05 mediaformat

Sorry for late reply --

This is a way to emulate a NoSQL database in MySQL using the capabilities of the time.

The entity_metadata table is essentially used as a search index that allows queries to find and return the full entities, which are then reconstituted from the JSON.

Very originally, Known was built on MongoDB, and this was an emulation layer that allowed MySQL to be used as well. Fun fact: it was based on an approach pioneered at Friendfeed.

benwerd avatar Jun 22 '24 19:06 benwerd