Is it better to repeat field or join to access the relationship?

1

Hello, thinking about performance and also good practices, what would be the ideal in this scenario?

3 Objects: - Company - Person who is representing the company - Visit (object related to a commercial visit of a seller)

For me to display the information to the user would it be better for me to leave it as in the image below? respecting the hierarchy or could you repeat data, putting the client id also in the table of visits so you do not need to give a join?

    
asked by anonymous 26.01.2018 / 16:04

1 answer

0

The ideal is to use the JOIN, because if you put the customer id in the VISIT table you will be creating a relationship that is redundant, since you can get the same information using the JOIN through the relation between the other tables (VISIT , CLIENT REPRESENTATIVE and CUSTOMER). This should be avoided according to the literature and best practices.

    
26.01.2018 / 17:10