我有170个属性的实体。这是车辆监控的数据。每个实体都有gps终端的数据标签和唯一标识。终端的日期、时间和id --这些是按操作分组的条件。我可以为所有实体创建一个表:
CREATE TABLE rows {
terminal_id long reference terminals(id),
time timestamp,
-- description 170 attributes
PRIMARY KEY(terminal_id, time)
}或者我可以创建许多具有关系的表:
CREATE TABLE rows {
row_id long PRIMARY KEY,
terminal_id long reference terminals(id),
time timestamp -- need create index for group by
}
CREATE TABLE gps {
row_id long references rows(row_id),
-- description gps attributes
}
CREATE TABLE fuel {
row_id long references rows(row_id),
-- description fuel attributes
}
-- etc.请为这种类型的数据库提供最佳结构。
发布于 2013-09-28 12:44:46
首先,对表应用规范化,并确保它确实是一个具有170个属性的表,而不是几个被阻塞在一起的表。
然后决定您的表是否将被稀疏填充,如果是的话,确定存储空间是否需要创建子表来保存可空列的子集。
如果确实决定创建子表,则在计算子表是否节省存储时,请记住要考虑额外的索引空间。
https://dba.stackexchange.com/questions/50689
复制相似问题