I have a table (MainObject) where each record can have subscribers and have notifications (table structure below). The application needs to send alerts when a notification occurs, for each subscription. Some of these individual records could have lots of subscribers - I have a feeling that the way I'm looking at designing this isn't very good for high usage, so for argument's sake let's say 100s of thousands of subscriptions per MainObject record in the highest cases.
Looking at the table structure below, is that the best way to design this? Let's say a MainObject record has 100,000 subscribers, and an application event occurs that creates a notification (so adds a Notification record). Now for each of the 100,000 subscribers, 100,000 Alert records would need to be inserted in the database. 100 simple application events would result in 10 MILLION alert records being created - there would literally be a backlog of thousands upon thousands of insertion statements at any given time! (Of course, an asynchronous application process could trigger the insertions, but my whole design doesn't seem ideal.)
This doesn't seem like a good design. How do high-throughput systems handle such subscription/notification design requirements? Have any of you modelled something like this before, or could help explain a better way of doing this?
MainObject
-----------
id
Subscription
------------
id
subscriber_id (fk)
mainobject_id (fk)
Notification
-----------
id
mainobject_id (fk)
Alert
-----
id
notification_id (fk)