Note that there are some explanatory texts on larger screens.

plurals
  1. POIs it a good idea to remove a Many-Many relationship by doing de-normalization
    text
    copied!<p>I have a Message and a Contract, Message is sent with many contracts, and a Contract can belong to several messages. It is not a straight forward many to many relation. </p> <ul> <li><p>A contract is having a status. I should keep track of Contract status for each message. Also Contract Start and End Date can be changed based on business logic and each message should have its versions of those values.</p></li> <li><p>Contract parties is only depending on ContractID, it will not be changed per message.</p></li> </ul> <p>Thus I made ERD like this:-</p> <p><strong>Contract</strong></p> <ul> <li>ContractID</li> <li>FirstParty</li> <li>SecondParty</li> <li>ApprovalDate</li> </ul> <p><strong>Message</strong></p> <ul> <li>MessageID</li> <li>MessageDate</li> </ul> <p><strong>MessageContract</strong></p> <ul> <li>ContractID</li> <li>MessageID</li> <li>ContractStatus</li> <li>ContractStartDate</li> <li>ContractEndDate</li> </ul> <p>The many to many relationship requires more complicated logic. Can I just move Contract columns to MessageContract and remove Contract table? De-normalization principles allows me to do that? </p> <p>Contract table is only used to hold these three columns, it does not have a relation with other tables except MessageContract and it will require me to select a contract before putting it in MessageContract, and I will do that a lot because I have like 20,000 message per day. I need every processor cycle to get a good throughput. I am just worry about scalability for the case a Contract is having a new relation with a new table. I can't see a reason to put a new table, but what if the system is live and I just need to add a new table. I mean what is the good practice for this case. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload