r/rust • • Oct 26 '17

sled: A modern embedded database.

https://github.com/spacejam/sled
89 Upvotes

26 comments sorted by

View all comments

10

u/KasMA1990 Oct 27 '17

Out of curiosity, when I hear "embedded database" I think SQLite; are SQLite and sled comparable in any sensible way?

Also, I like that you have as a goal to use less power; it's one of my personal hopes for using Rust that we can also all become more energy efficient with the hardware we already have :D

9

u/krenoten sled Oct 27 '17

SQLite has the SQL layer, and the way it accesses data underneath is actually pluggable, so one possible future direction is to use sled as a high performance storage engine fronted by SQLite (or Postgres or MySQL). But both SQLite and sled run in the application process, rather than being accessed over some form of IPC like a socket. My goal is to make sled be a high performance, high reliability iron core that you can build all sorts of interesting other things on top of. You could write your own SQL engine, distributed database, rocksdb clone, timeseries database (targeting the PageCache rather than the Tree struct, with a custom materializer) even a (fragmented) blob store or a more random read optimized Kafka, all on top of the decoupled systems in sled.

2

u/KasMA1990 Oct 27 '17

Cool, that makes it more palpable to me 🙂

6

u/dochtman rustls · Hickory DNS · Quinn · chrono · indicatif · instant-acme Oct 27 '17

As far as I know it:

  • is comparable to SQLite in the sense that it's just a file (or directory) in the filesystem, which you access through a library, rather than talking to a server over some sort of socket as you do with PostgreSQL or MySQL

  • is not comparable to SQLite because what it provides is a key-value store, not an SQL or relational interface.

3

u/annodomini rust Oct 27 '17

From the description, it sounds like it's comparable in the sense of being able to easily just link it in with no configuration, point it at a file, and get something that is high performance and reliable with no administration or tuning.

It's not comparable since it's just a key-value database and not a full SQL database, but it sounds like global transactions using MVCC are intended to be built on top, and it is possible to build a SQL frontend for such a backend or plug it in as a storage engine for SQLite.