Suggestions for a user notification system in MySql and PHP -


I am implementing a notification system and see if these suggestions are valid for setting up, if Better or better solution is available than any other:

An information has been added to the database. A guest / identifiable user logs on or uses the site.

  • Notification table stores notification texts and IDs.
  • Option 1: Alert table stores all users who have read the notification
  • Option 2: Alert table Store all users who have not read the notification

Is these options too much, is it probably better to add 100,000+ alerts and as such, users abandon their information or Interacted with them, change their position Bone or is deleted warning. This can be a very big desk ...

What is a more extensible set up for custom alerts based on user activity?

I will not do it like this, I keep a record (user, notification) for each and I mark each record as unread or unread. When you read it, you can record, which can be important depending on your application (for example, if you need any type of audit).

100k records are not too big Do not worry about size, unless you get at least 10 million records. If necessary, store them at some point. But you should guess somehow how quickly you will make 10 million records. If it is 3 days, then yes, you have a problem. If it is 3 years then you do not.

This option has the notification text in a separate table.

It should also be on a very good scale with a large number of messages. You can select unread messages for a user (indexed) and get notification text (if your table has millions of records Sizes) or select them, and then select different messages.

User (User, Notification) table is easy to divide: You make it base on user categories.

And when users delete messages, generally you should mark them instead of deleting it instead of deleting it. There is no reason to remove anything in the database most of the time.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -