SQLite Forum

CBOR Support & challenging DB design problem for keeping history with big schema changes
Login
Sidestepping the CBOR request completely since I don't care one way or the other, but to comment on the secondary question:

>  if I could plug a function of my language's implementation into SQLite, this will be just fine.

This is pretty easy to do in SQLite, see here: [sqlite.org/c3ref/create_function.html](https://sqlite.org/c3ref/create_function.html)

> The main question is how to build indexes on such...

Creating an Index on the result of a function has been possible in SQLite for quite some time now. So if you are successful at creating the functions you want to use (as above), then adding indexes based on them is trivial within the rules.

- See here: [sqlite.org/lang_createindex.html](https://sqlite.org/lang_createindex.html#indexexpr) - Point 1.2 - Indexes on Expressions, 
- and here: [sqlite.org/expridx.html](https://sqlite.org/expridx.html) - Note the section on restrictions.

If the intended functions are non-deterministic or violates any other of those rules, your only remedy will be, as Dominique suggested, making a virtual table module where you have control over indexing. This can be quite involved but is still very possible and example modules abound.

- See here: [sqlite.org/vtab.html](https://sqlite.org/vtab.html) 
- and here: [sqlite.org/c3ref/module.html](https://sqlite.org/c3ref/module.html).