Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: FPoBA on August 20, 2014, 06:06:41 PM



Title: What advantages does using LevelDB offer?
Post by: FPoBA on August 20, 2014, 06:06:41 PM
What are the advantages? Why was it implemented?

 ???


Title: Re: What advantages does using LevelDB offer?
Post by: CIYAM on August 20, 2014, 06:09:56 PM
When you are dealing with data that is mostly *binary* in nature a SQL DB doesn't really offer much advantage over a DB that is more "object based".

Basically you end up having to do *more work* with a SQL DB than a non-SQL DB to store/retrieve the records - so if you don't need SQL then it is actually going to be *faster* to not use it.

Understand that the *simplest* way to do things will always be the *fastest*.


Title: Re: What advantages does using LevelDB offer?
Post by: ScripterRon on August 20, 2014, 07:59:32 PM
What are the advantages? Why was it implemented?
I've used LevelDB, H2, Firebird and PostgreSQL with my JavaBitcoin node.  LevelDB wins hands-down on both performance and database size.  It is ideal for a bitcoin database where you have a small number of keys (usually just the transaction or block hash) and don't need the complexity of the SQL SELECT statement.  It is easy to implement a secondary index (such as block height->block) using a separate map.

Ron


Title: Re: What advantages does using LevelDB offer?
Post by: azeteki on August 20, 2014, 08:47:06 PM
The UXTO db as implemented stores unspent outputs, serialized, keyed by txid.

That's it. Want to know if a txid has unspent outputs? Look in the DB and deserialize the information.

Nothing more advanced than that is really required.


Title: Re: What advantages does using LevelDB offer?
Post by: FPoBA on August 21, 2014, 06:25:12 AM
Thanks for all your replies, I have a clearer picture now.  :)