logoalt Hacker News

bddickenyesterday at 7:47 PM2 repliesview on HN

Oh hey, I wrote this! Happy to chat more about the article here. Databases are kinda my thing.


Replies

amarantyesterday at 9:00 PM

Thanks for writing this! The visualisations really drive a better understanding than pure text does, and it's quite clear that you have a better understanding of what database do under the hood than I do.

As such, I have a question for you: contrary to your article, I've always been taught that random primary keys are better than sequential ones. The reason for this, I was told, was to avoid "hotspots". I guess it only really applies once sharding comes into play, and perhaps also only if your primary key is your sharding key, but I think that's a pretty common setup.

I'm not really sure how to formulate a concrete question here, I guess I would like to hear your thoughts on any tradeoffs on sequential Vs random keys in sharded setups? Is there a case there random keys are valid, or have I been taught nonsense?

show 2 replies
mamcxyesterday at 8:48 PM

I remember this article for when I was researching for https://spacetimedb.com/. The interactivity is very cool, BTW!

One neat realization is that a database is in fact more about indexes than the actual raw tables (all things interesting work under this assumption), to the point that implementing the engine you get the impression that everything start with "CREATE INDEX" than "CREATE TABLE". This includes sequential scans, where as visualized in your article show that lay the data sequentially is in fact a form of index.

Now, I have the dream of make a engine more into this vision...