News for hackers. Stuff that matters.
Re:PlanetScale Insights: Advanced query monitoring by datalopers on Thursday May 26, 2022 @01:09PM (#31520841)
Database-enforced FKs are an overrated crutch anyway. Apply the third normal form, utilize transactions correctly, and you won't ever need them.
Re:PlanetScale Insights: Advanced query monitoring by derekperkins on Thursday May 26, 2022 @09:46PM (#31525302)
Strongly disagree. They allow you to declaratively say what data is allowed. No system where devs write code is going to be infallible, no matter how much people want it to be true. Show me a database without FKs and I'll show you a database with orphaned rows and insistent data.

That being said, depending on the data you're working with, you may be fine with that trade-off.

Re:PlanetScale Insights: Advanced query monitoring by vvern on Thursday May 26, 2022 @10:29PM (#31525497)
> utilize transactions correctly

This seems hard to do in Vitess or PlanetScale given the technically READ UNCOMMITTED isolation [1] when cross shard, and, in scaled deployments, will still require experimental 2PC [2] cross shard transaction. So, like, yeah, if you had serializable isolation, then transactions might save you so long as your code isn't buggy, but, literally the reason the system doesn't implement them is because it doesn't have isolated transactions.

[1]: https://news.ycombinator.com/item?id=22170416#22177783 [2]: https://vitess.io/docs/13.0/reference/features/two-phase-com...

Re:PlanetScale Insights: Advanced query monitoring by derekperkins on Friday May 27, 2022 @10:52AM (#31530336)
In a production environment with well architected sharding, that rarely comes up in practice. It will be designed so that 99% of your operations happen on a single shard, both for performance and for transactional guarantees. That's often a customer/tenant id, and it's rare in practice that you will be performing cross-customer transactions.