TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Building Database on KV Store with Bytecode Generated Based on SQL

2 pointsby netforayover 10 years ago
Does my idea have any merit...<p>I need to implement a Multi tenant Database for an ERP like application. As of now using PostgreSQL with Meta tables(Like this https:&#x2F;&#x2F;developer.salesforce.com&#x2F;page&#x2F;Multi_Tenant_Architecture)<p>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.<p>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.<p>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?<p>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.

1 comment

tom_bover 10 years ago
I think if you are willing to trade the flexibility of normal relational back-end DBs for a storage of your own making, you can certainly optimize for a specific workload. But is that your case? Joe Celko made a comment in one of his SQL books that implied all data hackers wake up one day and think &quot;I know, I&#x27;ll just put everything into one big K&#x2F;V table . . . &quot;<p>Its interesting that you focus hard on &quot;no SQL. So no SQL parsing. No query plan preparation, . . . &quot;. Have you found SQL parsing and query plan prep to be actual bottlenecks in PostGres? This would be surprising to me.<p>Personally, I have found that occasionally doing simple things like memory mapping multi-gigabyte pre-sorted data and using simple binary search from within Java (well, Clojure to be truthful) can be quite performant. But that case involved static data and well-known search patterns. I have also flirted with column-stores for analytical workloads and they are pretty awesome for that.<p>There is such an explosion of options available these days in both relational and the NoSQL family. As much as I like hacking, I do try hard to ask myself &quot;why can&#x27;t one of these solutions do this hard work for me?&quot;<p>I suspect a 10x improvement will elude you (no such thing as a free lunch), but I geek out hard reading what other people do in these cases, so if you have a business case (or personal side-interest) to tackle your own data store, have at it. Post us what you find sometime. Good luck.
评论 #8730137 未加载
评论 #8732526 未加载