我们正在编写MMORPG并假设我们有以下表格。 location_dynamic_objects
是要查询和更新HEAVILY的表格。正如你可以看到position_x
,position_y
,location_id
列以及对象类型重复。但是,如果我们规范化并使用连接,我们将为选定的数据应用额外的过滤器。我们计划将所有location_static_objects
一次性发送给客户,因此将它们与location_dynamic_objects
保持在一起并没有真正的意义。 静态对象表示要呈现的不可移动数据,并在位置加载时向客户端发送一次。动态对象代表频繁更新的数据,如玩家,火箭,小行星等,并不断发送给客户端,取决于客户的位置和位置。 我们的问题是我们应该放弃规范化来实现绩效?RDBMS规范化与性能
create table location_static_object_types (
location_static_object_type_id integer auto_increment primary key,
object_type_name varchar(16) not null
);
create table location_static_objects (
location_static_object_id integer auto_increment primary key,
location_static_object_type_id integer not null,
location_id integer not null,
position_x integer not null,
position_y integer not null
);
create table location_dynamic_object_types (
location_dynamic_object_type_id integer auto_increment primary key,
object_type_name varchar(16) not null
);
create table location_dynamic_objects (
location_dynamic_object_id integer auto_increment primary key,
location_dynamic_object_type_id integer not null,
object_native_id integer not null,
location_id integer not null,
position_x integer not null,
position_y integer not null
);
我不确定仅仅因为可能会有一两个连接,你的表现将被毁坏。通过适当的索引,调整,也许还有一些应用程序缓存,事情可能会像你需要的那样快。 – mconlin 2013-04-06 23:27:44
只有在您经过全面测试并且有证据表明您需要恢复正常表单时,才应该进行标准化。 – Kermit 2013-04-06 23:30:27
即使我们添加索引,我们也需要过滤对象类型,重点是将未过滤的数据发送给客户端。 – OneMoreVladimir 2013-04-06 23:39:58