0

I am implementing a web-mail application.Only registered users can send, receive and view E-mails. When I start to design the database,I came up with following issue.
Lets say this application has pottentially 100 000 users (maybe more than this). each user can have thousands ( n*1000 ) of emails in their inboxes.What my question is...

Is it okay to create inbox table for each user dynamically OR create only one inbox table to all users?

If I use only one inbox table it will contain 100000*(n*1000) records.If I do other way only particular user's e-mails will stored in their respective inbox table. But there will be thousands of inbox tables in the database.

Can any one suggest a design clue...

4

1 回答 1

2

这是一个比第一次出现的更难的问题。通常情况下,倾斜是一张桌子。

但是,我们在这里谈论的是用户和电子邮件。在 SQL Server 中(与其他数据库一样),在表级别而不是在行级别处理权限要容易得多。因此,这是可能将您推向多个表的考虑因素之一。

尽管事实上多个表很困难:

  • 对数据结构的更改需要复制无数次。
  • SQL 旨在处理非常大的表,但不一定要处理很多表(尽管几千个应该不会造成问题)。
  • 简单的查询,例如“每个用户有多少未读电子邮件?” 变得几乎不可能。
  • 不能对收件箱表进行外键引用。
于 2015-10-10T16:45:38.100 回答