Mari Faleiros
Mari Faleiros

Reputation: 738

Is it worthy to create a one to one relationship?

I have a table A that has many fields that define A but also a lot of fields that define something that A can be, but not always. I'm thinking about splitting this entity in two: a reduced A entity containing only the fields pertaining to A and a B entity cointaining the fields that pertain to A when it "also assumes the form of B".

(To explain better: "A" is a table called Mission and "B" would be a table called Monster. It happens that, in my domain, a mission can be many things, and sometimes it is a monster. There are many fields that define a monster, so the original Mission table is huge).

That said, I'm debating myself whether I should or not create this Monster table. Should I just accept my fairly big Mission table or should I go ahead and create a 1:1 relationship? The Joins would be executed quite frequently, and I'm a bit worried about this.

Thanks in advance.

Upvotes: 0

Views: 79

Answers (1)

FDavidov
FDavidov

Reputation: 3667

I would go for 3 tables (not two):

  1. Table for the missions,
  2. Table for the Monster types (including for each type all the relevant properties),
  3. Table for the monster instances (i.e. when you need an actual monster); this table will hold a reference to the Monster type table that you can use whenever you need the Monster's properties.

In this way, your need for HUGE tables/space would be drastically reduced.

Upvotes: 1

Related Questions