adileo
While the other costs mentioned here can be optimized with current hardware prices and a good database, anti-crawling measures necessitate thousands of IPs/proxies, making the process even more challenging and costly.
* at the cost of dealing with long keys creating large indexes and more cache thrashing in the RDBMS. *
This is actually one of the point I'm currently dealing with. Especially finding the right trade-off to manage records in the order of hundred millions/billions, the right decision could save GB of space both on disk and RAM and seconds in computation during each JOIN operation for example.
That's why I drafted out a comparison table, sometimes I see people start using UUIDs right away just because they are offered as out of the box in some ORMs or just because it souds "cool", without knowing that there are better or simplier alternatives out there.
If you can't identify a natural key that indicates failure to normalize or even the wrong model of the data.
I'm not sure about this point. As a matter of fact a lot of entities in the real world do not have a natural key, or if they have it, it could be subject to changes. How do you identify a user or an anonymous post on a forum?
Maybe for an user you could just use the email. Then, what if the user want to change their email? Or what if one day you want to allow users to sign-up with just their social login?
Surrogate keys are always a good level of indirection to keep a consistent identity, and especially useful as foreign key and hence also as a primary key. Of course with some exceptions (eg. intermediate tables, where the PK is spanning across multiple columns)
But I'm curious to know also other scenarios since my view is skewed by the business domain I work in.
Choosing the best database primary key – INT and UUIDs alternatives
My next step is to understand the best way to not expose the primary key to the world, maybe an additional column with a public random id? Maybe encoding/decoding the PK with some cryptographycally secure algorithm in the REST API layer? Or better a key-value mapping cache layer between the public Id and the internal Primary Key?
Every insight is welcomed.
Usually these kind of communities probably need that their content should be indexable by Google or other search engines in order to be discovered by new users. So in my mind it shouldn't dilute the attention of the community members. Of course it's still a proof of concept and every feedback is super welcomed to understand better the environment
Using forums vs. Discord: why not both
Original thread: https://news.ycombinator.com/item?id=29154216
It's still in closed alpha right now. But I would love to know what you think about it.