Why I'm Building a Database Engine in C#

15 points by hongminhee


eatonphil

Nobody builds high-performance database engines in .NET.

See also RavenDB (in C#) or any number of databases in Java (Cassandra, Neo4j, QuestDB, Elasticsearch, Kafka, etc.).

joshka

To me the justifications against rust read as a skillfamiliarity issue (the developer is more familiar with C# than Rust) rather than inherent problems.

In C or Rust, you’d build much of this yourself or stitch together crates/libraries with varying quality. In .NET, this is production-grade and free: ILogger and OpenTelemetry for observability, BenchmarkDotNet for rigorous micro-benchmarks, NUnit for testing, IConfiguration for settings. All well-documented, all interoperable, all maintained by Microsoft or battle-tested OSS communities.

Rust’s ecosystem for the surrounding infrastructure (logging, DI, configuration, testing) is also less mature than .NET’s, and as a solo developer, my velocity matters. I chose the language where I ship faster.

Rust has tracing for logging, OpenTelemetry for observability, criterion for benchmarks, testing built in, serde + toml for settings (as well as confy / figment if you want that approach). DI is an OOP concept for the most part and easy to get the good bits in rust without a framework / blessed approach.

This feels like post hoc rationalization a bit. And that's ok.

trenchant

This says a lot about how it can be done. I don't be believe we ever got around to why we would write another database engine.

orib

Slop.

Edit: both the article and the code.

siru

Correct me if I'm wrong, and please do because I can hardly claim to have fully comprehended the whole article, but aren't you basically just showing that you can write C code inside a C# context? All of the solutions you mention force you to write C-like code and turn off all the extra stuff that C# provides. How is this different than writing a DB engine in Python, but all the important parts are just calling embedded C functions?