Click here to Skip to main content
15,867,453 members
Home / Discussions / Database
   

Database

 
PraiseRe: Best Praxis for “user-id/primary” Pin
User 1106097918-Feb-17 0:27
User 1106097918-Feb-17 0:27 
GeneralRe: Best Praxis for “user-id/primary” Pin
Eddy Vluggen19-Feb-17 8:45
professionalEddy Vluggen19-Feb-17 8:45 
QuestionVery big database question. Need answers ? Pin
Yogi S.17-Feb-17 7:27
Yogi S.17-Feb-17 7:27 
AnswerRe: Very big database question. Need answers ? Pin
Eddy Vluggen17-Feb-17 7:52
professionalEddy Vluggen17-Feb-17 7:52 
QuestionHow to calculate the eligibility year of Promotion if Present Year - last year of Promotion is greater than or Equals to 3 (Three) Pin
Okezie Victor17-Feb-17 0:05
Okezie Victor17-Feb-17 0:05 
AnswerRe: How to calculate the eligibility year of Promotion if Present Year - last year of Promotion is greater than or Equals to 3 (Three) Pin
Mycroft Holmes17-Feb-17 12:57
professionalMycroft Holmes17-Feb-17 12:57 
GeneralRe: How to calculate the eligibility year of Promotion if Present Year - last year of Promotion is greater than or Equals to 3 (Three) Pin
Okezie Victor28-Mar-17 3:46
Okezie Victor28-Mar-17 3:46 
Questionwhat is the best way indexing foreign key from multiple table? Pin
Gilbert Consellado9-Feb-17 23:30
professionalGilbert Consellado9-Feb-17 23:30 
What is the better way of indexing the foreign key?
SQL
Create Table table3(
  t3_id int not null auto_increment,
  t1_id int not null,
  t2_id int not null,
  primary key (t3_id),
  index IX_index (t1_id, t2_id), // this is my concern
  constraint FK_t1 foreign key (t1_id)
  reference table1(t1_id),
  constraint FK_t2 foreign key (t2_id)
  reference table2(t2_id));

or
SQL
Create Table table3(
  t3_id int not null auto_increment,
  t1_id int not null,
  t2_id int not null,
  primary key (t3_id),
  index IX_t1 (t1_id), //this is my concern
  index IX_t2 (t2_id), //and this
  constraint FK_t1 foreign key (t1_id)
  reference table1(t1_id),
  constraint FK_t2 foreign key (t2_id)
  reference table2(t2_id));


This is for innodb tables, I dont have a broad understanding how the btree works. But as far as I know, the first table will save the indexes on single area while the second is not (correct me if I am wrong). And if it is what is the pros and cons if I will put it on a single index or multiple index?

Thanks.

modified 10-Feb-17 6:41am.

AnswerRe: what is the best way indexing foreign key from multiple table? Pin
Eddy Vluggen10-Feb-17 0:58
professionalEddy Vluggen10-Feb-17 0:58 
GeneralRe: what is the best way indexing foreign key from multiple table? Pin
Gilbert Consellado10-Feb-17 1:54
professionalGilbert Consellado10-Feb-17 1:54 
SuggestionRe: what is the best way indexing foreign key from multiple table? Pin
Richard Deeming10-Feb-17 2:56
mveRichard Deeming10-Feb-17 2:56 
GeneralRe: what is the best way indexing foreign key from multiple table? Pin
Gilbert Consellado10-Feb-17 3:25
professionalGilbert Consellado10-Feb-17 3:25 
QuestionNot sure how to handle this sort of speaking FoxPro DBF Pin
jkirkerx9-Feb-17 7:31
professionaljkirkerx9-Feb-17 7:31 
AnswerRe: Not sure how to handle this sort of speaking FoxPro DBF Pin
jkirkerx9-Feb-17 7:40
professionaljkirkerx9-Feb-17 7:40 
GeneralRe: Not sure how to handle this sort of speaking FoxPro DBF Pin
Gerry Schmitz9-Feb-17 8:17
mveGerry Schmitz9-Feb-17 8:17 
GeneralRe: Not sure how to handle this sort of speaking FoxPro DBF Pin
jkirkerx13-Feb-17 6:40
professionaljkirkerx13-Feb-17 6:40 
GeneralRe: Not sure how to handle this sort of speaking FoxPro DBF Pin
Gerry Schmitz13-Feb-17 9:32
mveGerry Schmitz13-Feb-17 9:32 
GeneralRe: Not sure how to handle this sort of speaking FoxPro DBF Pin
jkirkerx13-Feb-17 11:44
professionaljkirkerx13-Feb-17 11:44 
SuggestionRe: Not sure how to handle this sort of speaking FoxPro DBF Pin
Richard Deeming9-Feb-17 9:14
mveRichard Deeming9-Feb-17 9:14 
GeneralRe: Not sure how to handle this sort of speaking FoxPro DBF Pin
jkirkerx13-Feb-17 6:34
professionaljkirkerx13-Feb-17 6:34 
QuestionHow do I model this? Pin
Jörgen Andersson7-Feb-17 12:58
professionalJörgen Andersson7-Feb-17 12:58 
AnswerRe: How do I model this? Pin
Mycroft Holmes7-Feb-17 21:52
professionalMycroft Holmes7-Feb-17 21:52 
GeneralRe: How do I model this? Pin
Jörgen Andersson7-Feb-17 22:03
professionalJörgen Andersson7-Feb-17 22:03 
AnswerRe: How do I model this? Pin
Gerry Schmitz9-Feb-17 8:32
mveGerry Schmitz9-Feb-17 8:32 
AnswerRe: How do I model this? Pin
Eddy Vluggen9-Feb-17 10:28
professionalEddy Vluggen9-Feb-17 10:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.