私は自分のウェブサイトの通知システムを作ろうとしています:
これがテーブル構造です
notification
-----------------
id (pk)
userid
notification_type (for complexity like notifications for pictures, videos, apps etc.)
notification
time
notificationsRead
--------------------
id (pk) (i dont think this field is required, anyways)
lasttime_read
userid
私の理解では、通知が追加されたら、ユーザーの友達を見つけて、それらすべての行をnotification
テーブルに挿入する必要があります。これが正しい場合、これを達成するための最良の方法は何でしょうか?
- トリガー?
- T-SQL (サーバー側の SQL クエリ) を記述して、すべての友人を選択し、SQL 一括コピーを使用しますか?