Hi, I use SQLite as a MaybeSQL store, mixing fixed columns with schemaless JSON columns. It's really great.
In JavaScript, objects are key-value collections with unique keys, where the order of the keys is important. Most JSVMs store them as a pointer to a layout and then the values. The layout lists the keys in order (and possibly the types, to get byte-perfect layouts). If you delete a key from an object, it generates a new layout. I was wondering if the JSON extension could not do the same thing: for each table, keep a hidden stash of object layouts, and store the values as sqlite primitives. (you'd be able to disable this, in case the layouts rarely repeat) This way: - it's more space efficient, since they keys are only stored once per layout - loading is faster, because the values are stored as their primitive type - querying can go faster Queries can go faster, because a query like `where json_extract(json, '$.foo') = 'bar'` can first check the layouts to see which ones apply, allowing to skip other layouts, and then quickly find the value to test thanks to the binary encoding You could also allow an optimization that makes key order unimportant, reducing the number of layouts. So, smaller and faster. Thoughts? Wout. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users