I would like to ask a question about database design. I'm doing a website which has a notification system using to push some system notification to the users (similar to facebook, but much simple). The message will only be some pre-set format, for example, message 1 is "{{name}} ask you a question". The {{name}} will be a variable depends on which member is involved in the notification.
我想问一个关于数据库设计的问题。我正在做一个网站,它有一个通知系统用于向用户推送一些系统通知(类似于Facebook,但很简单)。该消息只是一些预先设定的格式,例如,消息1是“{{name}}问你一个问题”。 {{name}}将是一个变量,取决于通知中涉及的成员。
The question is, how to save {{name}} in database. There are two choice in my mind: 1. use a varchar column to save the name as a string. 2. use a number column to save the member id and select the name by the member id from member table on request.
问题是,如何在数据库中保存{{name}}。我有两种选择:1。使用varchar列将名称保存为字符串。 2.使用数字列保存成员标识,并根据请求从成员表中按成员标识选择名称。
To consider about the system load, which one would be better?
要考虑系统负载,哪一个会更好?
1 个解决方案
#1
0
It would be better to save the member id instead of using the varchar name. This is because if in future the name of the user changes in the master table, it will be automatically reflected to ur notification part.
最好保存成员标识而不是使用varchar名称。这是因为如果将来用户名在主表中更改,它将自动反映到您的通知部分。
#1
0
It would be better to save the member id instead of using the varchar name. This is because if in future the name of the user changes in the master table, it will be automatically reflected to ur notification part.
最好保存成员标识而不是使用varchar名称。这是因为如果将来用户名在主表中更改,它将自动反映到您的通知部分。