TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Stripe complete schema for database/API design learning and inspiration

5 点作者 fgribreau超过 5 年前

2 条评论

davismwfl超过 5 年前
I don&#x27;t know who this guy is (maybe I am out of touch), but it doesn&#x27;t appear he works at stripe or is affiliated from what I see, maybe I just missed it. So is this actually Stripe&#x27;s schema or just what he thinks it looks like or should look like?<p>Either way, it is always interesting to see how other people lay out data systems, especially when the data system is for a large dataset.<p>A couple of key things stood out to me right away though. Using varchar for every id, I get in very high transaction tables int (even bigint) can sometimes be a problem but there are solutions to those and int performance will always be superior, not to mention far less memory&#x2F;disk space used generally.<p>Also the use of bigint for fixed range values is a little weird, like the legal_entity_dob_day, month &amp; year, where for each of them it could&#x27;ve been a 2 byte int and been fine (or even tinyint at 1 byte), taking up far less space. This isn&#x27;t a big deal for a table with 1,000 records, but for millions&#x2F;billions it adds up quickly. Probably on the accounts table the size difference is reasonably minimal, but the same thing is on transactional tables which will grow significantly so those extra bytes do matter. I have seen people standardize values this way for coding purposes but that generally isn&#x27;t good DB architecture&#x2F;design overall IMO.<p>Obviously stripe is super successful and if this is their actual schema, even if it was at one point, it worked for them. But if so I&#x27;d be interested in understanding their choices around like the varchar id&#x27;s and bigint&#x27;s for small fixed range values etc.<p>*edit -- clarified a little
jbverschoor超过 5 年前
I think this is deduced from the stripe api, which most likely resembles the actual implementation quite well. The ids could be some unique reference instead, and I’d assume that the metadata info are json fields in each table.<p>Nice to have it laid out. A relational diagram would be a great addition.