Curious - would Rust be more appropriate than Go for such a task?
rust would be more appropriate if your intention was to use this in production. Databases ad GC don't mix well. (its done but it makes tuning a nightmare) As much as I love rust, its learning curve is high and I'm sure Op doesn't want to spend half his article teaching all the intricacies of types and the borrow checker. Go is easy to learn over a weekend so its probably a better medium for illustrating the concepts…
Writing a SQL database from scratch in Go
51–55 of 55 posts
Re: Writing a SQL database from scratch in Go
#52Earlier quoted context omitted.
Having standards like that and keeping them helps a lot. Next time you have a different keyword, you don't have to think "does it deserve a constant?" - all of them do. Similar to how linters stop you from overthinking indentation in specific cases, or some naming standards, and later rename/reformat-wars.
all of them do. That's what leads to dogmatic cargo-culting. Good software is written by thinking about the circumstances and doing what makes the most sense, not by mindless rule-following that don't always make sense. I don't know why someone would be so worried about typos and introduce more verbosity and redundancy in the process; but then again, I don't use an IDE and I've never had this problem.
Good software may mean thinking about circumstances like "we're dealing with lots of text parsing and have seen bugs from typos in common keywords" and doing what makes most sense: "let's prevent those in the future, but using constants for keywords". It's only cargo culting if you don't know why you're doing something.
Setting a rule so you don't have to debate something later is a valid solution and may still offset some redundancies introduced this way.
Re: Writing a SQL database from scratch in Go
#53Do you know about a tutorial or a book that helps write Database from scratch either in Java or C?
Re: Writing a SQL database from scratch in Go
#54Earlier quoted context omitted.
Golang works too. There is a few databases written in Golang, such as Prometheus, InfluxDB, CockroachDB, or tidb. https://github.com/topics/database?l=go&o=desc&s=stars
Note that neither CockroachDB or TiDB use Golang for their actual storage engine, which is in both cases written in C (RocksDB). They do use Golang for SQL parsing though, which is what this post was mostly about.
[1] https://github.com/VictoriaMetrics/VictoriaMetrics
[2] https://github.com/klauspost/compress/tree/master/zstd#zstd