Approach to generic database design

前端 未结 2 952
耶瑟儿~
耶瑟儿~ 2021-01-22 15:53

An application that I\'m facing at a customer, looks like this:

  • it allows end users to enter \"materials\".
  • To those materials, they can append any number
2条回答
  •  灰色年华
    2021-01-22 16:48

    You could consider separating your MaterialsProperties table by typel e.g. into IntMaterialProperties, CharMaterialProperties, etc. This would:

    • Partition your data.
    • Allow for potentially faster look-ups for integer (or other numeric) type look-ups.
    • Potentially reduce storage costs.

    You could also introduce a Type column to Properties, which you could use to determine which MaterialProperties table to query. The column could also be used to validate the user's input is of the correct type, eliminating the need to query given "bad" input.

提交回复
热议问题