数据库设计,减少联接

这是机票在线商店的数据库(例如Airbnb体验)

对于产品(门票),

有可用的日期(和时间)

在有空的一天  -可能有多个选项(例如,初学者,高级)  -有数量可以出售(在多个选项中共享)

一种表示方式是

Product
  name

Variant (Option)
  product

TimeSlot
  product
  date
  time
  quantity


TimeslotVariant
  variant
  timeslot

另一种方法如下。

我看到两个主要区别,

  • First difference

    • Above: you need join on TimeSlot to find what variants are on given day.
    • Below: you can directly query TimeVariant
  • Second difference

    • Above: [{date, time, [variant1, variant2], quantity}] (I think client application would prefer this)
    • Below: [{date, time, variant1}, {date, time, variant2}] + [{date, time, quantity}]
Product
  name

Variant (Option)
  product


TimeSlot
  product
  date
  time
  quantity

TimeVariant
  variant
  date
  time

我认为第一个选项更直观(?),但我也认为附加的连接有时很难维护

我应该问自己哪些问题(标准),以在这两个问题中做出决定?