Ask HN: Building Database on KV Store with Bytecode Generated Based on SQL
I need to implement a Multi tenant Database for an ERP like application. As of now using PostgreSQL with Meta tables(Like this https://developer.salesforce.com/page/Multi_Tenant_Architecture)
My plan is to use a simple Key-Value database like BDB, LMDB, LevelDB and remove all SQL from the code. Any Indexing, Querying is performed by Java code generated specifically to use K-V db for that purpose.
By doing this I want to gain 10x DB performance compared to SQL.There is no SQL. So no SQL parsing. No query plan preparation, as I will prepare the plan in compile time and generate the Bytecode(using ASM) to use KV db. There is no other process, it is embedded, so no memory copy. No network in between. Even plan to use LMDB specifically so that no data copy is needed across buffers(LMDB uses Memory Mapping). Every plan is prepared in advance in code. Any SQL Database anyway uses some kind of KV store in backend.
My question to the experts here is... How does this sound? Can I get 10x(or even more) performance compared to PostgreSQL across Network? What other parameters I might be missing?
Notes: Replication, Scalability beyond one server are not required as they are handled at Application Level. I know that my Query plans may not be as good as what DB server do. But at least it is in my control and it is not rocket science to copy the similar plans.