When to use inherited tables in PostgreSQL?

后端 未结 7 1097
遇见更好的自我
遇见更好的自我 2020-12-12 11:40

In which situations you should use inherited tables? I tried to use them very briefly and inheritance didn\'t seem like in OOP world.

I thought it worked like this:<

相关标签:
7条回答
  • 2020-12-12 12:22

    I use inheritance when I have more than 1 on 1 relationships between tables.

    Example: suppose you want to store object map locations with attributes x, y, rotation, scale.

    Now suppose you have several different kinds of objects to display on the map and each object has its own map location parameters, and map parameters are never reused.

    In these cases table inheritance would be quite useful to avoid having to maintain unnormalised tables or having to create location id’s and cross referencing it to other tables.

    0 讨论(0)
提交回复
热议问题