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 > Database Server Software > MySQL > junction table, foreign key performances

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-19-11, 05:22
atikenny atikenny is offline
Registered User
 
Join Date: Aug 2011
Posts: 1
junction table, foreign key performances

Hi Everyone!

I'm designing a database for a company and I came across the following dilemma. Almost every table I have to create must include two id's (it's some sales stuff) coworker id and costumer id and some other columns. For example there's the sales table. Which one is better for these kind of structures:

1: keep the common ids in every table like this:

sales table:
--sales id
--coworker id (foreign key)
--costumer id (foreign key)
--detail1
--detail2
--
--
--etc.

or

2: create a junction table like this:

sales table:
--sales id
--detail1
--detail2
--
--
--etc.

junction table1:
--sales_coworker_id
--sales id
--coworker id

I know that with the junction tables you have to create the joins or views if you want to get all the details of one sale and I think it's slower than keeping it in the sales table but how much. And is there any benefit of creating a junction table structure like the one above?

Thanks for the help!
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