우리는 MMORPG을 쓰고 있으며 다음 표가 있다고 가정합니다. location_dynamic_objects
은 쿼리되고 무겁게 업데이트 될 테이블입니다. position_x
에서 볼 수 있듯이 position_y
, location_id
열은 개체 유형과 마찬가지로 복제됩니다. 그러나 조인을 정규화하고 사용하는 경우 선택한 데이터에 대해 추가 필터를 적용해야합니다. 우리는 모든 location_static_objects
ONCE를 클라이언트에 보내려고하므로 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
);
조인이 있거나 2 개의 성능이 망가질 수 있기 때문에 확실하지 않습니다. 적절한 색인 생성, 조정, 어쩌면 일부 응용 프로그램 캐싱을 사용하면 필요한만큼 빠르게 작업을 수행 할 수 있습니다. – mconlin
철저한 테스트를 거쳤으며 정상적인 양식으로 돌아 가야한다는 증거가있을 때만 정상화해야합니다. – Kermit
인덱스를 추가하더라도 객체 유형을 필터링해야하며 필터링되지 않은 데이터를 클라이언트에 보내야합니다. – OneMoreVladimir