对于 1 GB 数据库来说,多少个表过多?

发布于 2024-12-29 06:52:52 字数 1431 浏览 0 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

弥枳 2025-01-05 06:52:52

答案取决于每个表中有多少数据。

表本身几乎不占用空间 - 是行导致数据库大小增长。

您需要做的是估计在可预见的将来每个表将有多大 - 最好不要将表放在一起。

也就是说,具有 43 个字段的 9 个表(假设行大小合理)每个表需要数十万行才能接近 1GB。我有一个数百万行的 SQLite 文件,只有 100MB。

The answer depends on how much data is going to be in each table.

A table itself takes up almost no space - it's the rows that make the database size grow.

What you need to do is estimate how large each table is going to get within the foreseeable future - erring on the side of keeping the tables together.

That said, nine tables with 43 fields (assuming reasonably sized rows) would need to have hundreds of thousands of rows each to approach 1GB. I have a multi-million-row SQLite file which is only 100MB.

雄赳赳气昂昂 2025-01-05 06:52:52

这取决于。

您期望有多少数据?

如果您必须管理多个数据库,那会变得多么复杂?

查询多个数据库并聚合结果会慢多少?

性能有多重要?

将所有内容放在一个数据库中会给您带来更好的性能(通常)并且更容易开发。您应该这样做,直到您的数据变得足够大以至于数据库无法容纳为止。

It depends.

How much data are you expecting?

How much more complicated is it if you have to manage multiple databases?

How much slower will it be to query multiple databases and aggregate the results?

How important is performance?

Putting everything in a single database will give you better performance (usually) and is easier to develop. You should do that until your data gets big enough that you outgrow the database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文