If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Normalization Concept

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-03-10, 09:47
golden12 golden12 is offline
Registered User
 
Join Date: Sep 2010
Posts: 2
Normalization Concept

Hi Everyone,

This is my first thread on this forum.

I have some database concept doubt that i explain using two cases.

Case 1. There is two table A and B

Relationship between table A and B is (A (1) - > B(M)).

Case 2. there is three table A,B and AB

A and B table relationship are maintained in AB.

Both table A and B has a million of record.

now if i want to fetch the record from database then which case is better.
Case 1 or case 2.

Accordingly me Case 2 is better because when we are fetching record.
From any table it will scan the table AB and only scan the subset of B which we are getting from table AB.

now i need people suggestions to which case is better.

Thanks,
Ganesh Shirsat
Reply With Quote
  #2 (permalink)  
Old 09-03-10, 12:33
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
The first instance represents a one-to-many relationship.
The second instance represents a many-to-many relationship.
The first instance is faster, so use it whenever a many-to-many relationship is not required. But if a many-to-many relationship is required then you must use the second instance.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #3 (permalink)  
Old 09-07-10, 03:16
golden12 golden12 is offline
Registered User
 
Join Date: Sep 2010
Posts: 2
Thanks blindman for your suggestion.

could you please explain me, how second instance is better?

how exactly database explain plan on both instance?.

is there is any way to find this all minor detail?

thanks
Reply With Quote
  #4 (permalink)  
Old 09-07-10, 09:06
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Which is better, a fork or a spoon?
Neither is "better". They do two different things. The first represents a one-to-many relationship, and the second represents a many-to-many relationship.
Use whichever one is appropriate for your business requirements.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On