Ste*_*anM 8 database postgresql database-design hibernate
我需要设计一些数据库表,但我不确定性能影响.在我的情况下,它更多地关于读取性能而不是保存数据.
情况
借助模式识别,我可以找到需要在postgresql数据库中保存多少某个对象的值.其他数量让我们说固定属性唯一的区别是需要保存相同类型的1,2或3个值.
目前,我有3个实体/表,它们的区别仅在于具有相同类型的1,2或3个不可空的属性.
例如:
EntityTestOne/TableOne {
... other (same) properties
String optionOne;
}
EntityTestTwo/TableTwo {
... other (same) properties
String optionOne;
String optionTwo;
}
EntityTestThree/TableThree {
... other (same) properties
String optionOne;
String optionTwo;
String optionThree;
}
Run Code Online (Sandbox Code Playgroud)
我希望生产中有数百万条记录,并且我正在考虑这种变体的性能影响以及可能的替代方案.
备择方案
我想到的其他选择:
例如:
EntityOption {
String value;
}
EntityTest {
... other (same) properties
List<EntityOption> options;
}
Run Code Online (Sandbox Code Playgroud)
由于我不是那么强大的数据库设计和使用hibernate我对这些方法的优缺点感兴趣,如果有更多的选择.我甚至想问一个问题,如果postgresql是正确的选择,或者是否应该考虑使用另一个(免费)数据库.
谢谢!