156 points · by kiyanwang · 6y ago · 61 comments
> https://github.com/cmu-db/dbdb.io/blob/master/dbdb/settings....
https://github.com/samsquire/hash-db https://github.com/samsquire/sql-database
These are my very straightforward codebases where I've been experimenting with SQL parsing (and execution) and dynamo db style querying.
You need an efficient range operator to implement a database.
https://github.com/rqlite/rqlite/blob/master/DOC/DESIGN.md
I built a distributed database using Raft and SQLite, and I put a lot of thought into its design and implementation -- to make it as simple (but not simplistic) and clear as possible. One goal was clear separation between the consensus layer, the database access, and the HTTP API. I think it's a good resource to study (even if I do say so myself).
Here's a Github mirror so you can browse around: https://github.com/postgres/postgres
Note that the offical repo is at git.postgresql.org.
x Supports Foreign Keys
x Supports Stored Procedures
x Supports SQL Query Interface
No Postgresql?
The limitation with SQLite is that it doesn't support concurrent writes well - it needs to take a lock on the entire database to perform a write.
Writes are crazy fast (a few ms) so this often isn't a problem - but it does mean you wouldn't want to use it to build a site that has many people writing at once, like Hacker News for example.
For a site that has low (or no) writes, SQLite works really well even at a much larger scale - 100s of requests a second.
> PRAGMA journal_mode=WAL;
It still doesn't let you have concurrent writes but it does mean that reads won't error if a write is going on at the same time.
The traffic from a HN frontpage is relatively low per second tbh.
Presumably a service uses SQLite to simplify their ops. So long as the caching layer is equally simple to maintain, then SQLite continues to make sense to me
I wonder if that's how it is in production.
I suppose there would be a bunch of rewriting to do searching (lunr.js maybe) and filtering client side.
Buuuuuut, at this point, just turning on caching would be easier.
Going even further, there are no competing technologies (i.e. hosted SQL solutions) which, when running in single node/instance mode, are competitive with the performance of well-tuned SQLite.
PRAGMA journal_mode=WAL makes all the difference in the universe.
Speaking of,
What would an interesting version of "database of databases" look like?
Technically, this is database virtualization, which isn't really a new concept. We're implementing it as a database proxy, using PgBouncer instances to intercept queries and route them to Splitgraph engines. Within a Splitgraph engine (which is Postgres + some custom code), each "table" is either a "mounted" live database via a foreign database wrapper (FDW), or part of a point-in-time, versioned database snapshot called a "data image" that you can build with sgr.
Screenshot that makes it easier to understand: https://www.collibra.com/wp-content/uploads/Blog-DataLineage...
Let me download the sqlite database directly! Andy?
this site could benefit greatly from not running on a database and being statically generated. even the browse section could just be a vuejs app powered by a json collection.
The answers for access and Oracle are both brilliant and true.