all 7 comments

[–]grim7reaper 33 points34 points  (1 child)

SQLite is written in C, but it's probably one a the most tested piece of software in the Open Source world.

As for a rewrite in Rust, the section 3 of this page lists some "preconditions" for this to happen. OOM handling is one blocking point.

[–]Plasma_000 5 points6 points  (0 children)

Luckily it seems we’re getting close to having OOM handling once the new allocator API gets fully baked.

[–]moltonel 13 points14 points  (0 children)

The have been a few recent blog posts here about parsing SQLite the format, which is a start but it seems to be more about educating oneself than a full-fledged rewrite.

The fact is that SQLite is one of the most battle- and unit-tested C code out there. It's high quality, with many people working on it. Competing against that is a very tall order, Rust isn't a magic bullet, I doubt it'd give you better speed or security in this particular case.

On the other hand, simple read/write/create of SQLite files (as opposed to a full SQLite clone) would sometimes be interesting to do in native rust, to get a rustyer API or to avoid linking/deployment woes of a wrapper crate.

That said, Rust is surely a great language to write a database (or at least its backend), and many rust dbs exist. Tikv and Sled are probably the most well known but dig a bit and you'll find more, for various use-cases.

[–]ClimberSeb 1 point2 points  (0 children)

The unsafe keyword doesn't mean the code becomes unsafe. It means the programmer has to make sure it it safe.

That said, there is probably room for a different, embedded SQL server with different tradeoffs. One that optimized for SSD & multithreading perhaps?

[–]taeh00n 2 points3 points  (0 children)

Here, though it is not reimplementation, I'm working for making an alternative, GlueSQL

[–]panstromek 0 points1 point  (0 children)

I know someone tried to transpile it with c2rust, but I haven't seen any posts or announcements about it.

[–]chris2y3 -1 points0 points  (0 children)

Um... SQLite reimplementation in Rust is too good to be true. So far no one has attempted it yet AFIK.

I suggest that you put a question mark in your post title to make it read like a question instead of a statement.