4

1) Ethereum needs to store lots of data whose identifier can be said to be purely random. It makes use of LevelDB, whose indexing/sorting properties are useless here since the very key is random.

The obvious questions are - why LevelDB? Why not MySQL for instance, so to drastically improve information retrieval performance. (introduce indexing based on block height etc) Let's forget the security/ concurrency aspects which I've seen brought up. The purpose of a database is to facilitate efficient data storage and retrieval. Proper software design should be able to secure access to a local MySQL instance as well.

Thus, what's the rationale?

2) How is the data laid out in the database?

  • Good question. For sure I only know that geth is using LevelDB. What about other clients? Here are some infos on that topic -> ethereum.stackexchange.com/questions/824/… . Please also check the "Related"-sidebar! – ivicaa Feb 27 '18 at 14:34
  • I wonder if it's a path dependency that follows Bitcoin's implementation. Ethereum was inspired by Bitcoin, it also uses the same elliptic curve. I wonder if the initial implementation chose level db due to the same reason. – Linmao Song Feb 27 '18 at 14:39
  • Also, Parity uses RocksDb: ethereum.stackexchange.com/questions/13639/… – Linmao Song Feb 27 '18 at 14:55
  • The question would be still perfectly valid for RocksDb with which I'm very familiar. The performance improvements stem from implementation decisions/compression etc. In RocksDB we would be still querying random keys and do not benefit from sorting. I'm talking about using block numbers as keys for instance. – Vega4 Feb 27 '18 at 15:21
  • Sure the way RocksDB is implemented would aid us much more than LevelDB but still. – Vega4 Feb 27 '18 at 15:27

Browse other questions tagged or ask your own question.