Postgresql 设计多态事件模式

Postgresql 设计多态事件模式,postgresql,database-design,Postgresql,Database Design,我正在我的应用程序中实现多态事件模式 将有许多类型的事件,每种类型都与数据库中的其他表具有不同的关系 我在想类似的事情 - AppEvents(id, type, subtype, data::json) - VisitorEvents(app_event_id, visitor_id) - ConversationEvents(visitor_event_id, conversation_id, message_id, user_id) - TrackingEvents(visitor_eve

我正在我的应用程序中实现多态事件模式

将有许多类型的事件,每种类型都与数据库中的其他表具有不同的关系

我在想类似的事情

- AppEvents(id, type, subtype, data::json)
- VisitorEvents(app_event_id, visitor_id)
- ConversationEvents(visitor_event_id, conversation_id, message_id, user_id)
- TrackingEvents(visitor_event_id)
其中,
AppEvent
是与每个子类关联的基类

我的问题是,如果我想要所有与
对话
访问者
相关的事件,那么这个模式是否会效率低下,因为它可能需要相当多的连接

我还希望events表是相当写密集型的,并且必须对每个外键进行索引,这可能会降低插入速度

AFAIK的另一种方法是使用一个
AppEvent
表,其中包含许多可为空的关联列

有什么建议吗