Well, as a “baby step” I would prefer don’t have any additional software, like a real sql engine. I hope I could write a proof of concept based only in blockchain storage,
Take into account that having a sql engine and storage (like sqllite), implies we should resolve the “fork problem”. It’s not only the state at block 12, but we should retrieve the state at block 12 hash H1, vs block 12 hash H2 or anything else.
Having the data in storage, we could solve that problem. Modified by smart contract, then iterate on performance (precompiled, in memory cache, etc)
Only after all that, I would add a query language, that could be preprocessed offchain, maybe, at that point