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 > How to make JOIN more performant?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-12-04, 06:50
lenok lenok is offline
Registered User
 
Join Date: May 2004
Posts: 2
Question How to make JOIN more performant?

Hello!

I have a normalized MySQL database. Now I have a task to join all tables in the database, in order then to use universal query to it. I know that it is not a good idea, but in any case I must do it.

I made LEFT OUTER JOIN to join tables. It looks like:
SELECT * from language L
LEFT JOIN (select documentId as docId,documentName,parentDocId,version,creationDat e,
lastChanges,tiId,languageId as docLanguageId,description,readOnly,keywords,conten t,documentType from document)
AS D on L.languageId=D.docLanguageId
LEFT JOIN timeinterval TI on TI.tiId=D.tiId
LEFT JOIN activity A on A.activityId= TI.activityId
LEFT JOIN project P on P.projectId= TI.projectId
LEFT JOIN groupproject GP on GP.projectId = P.projectId
LEFT JOIN ugroup G on G.groupId = GP.groupId;
......

I will not write the whole join, it is too big.

It takes too much time to execute this query. Maybe somebody knows how to do it in more performant way, could you, please, help me?

thank you in advance.
Reply With Quote
  #2 (permalink)  
Old 05-12-04, 08:00
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
Are your tables indexed? If not that is where you are losing all sorts of time on the join.
Reply With Quote
  #3 (permalink)  
Old 05-13-04, 05:28
lenok lenok is offline
Registered User
 
Join Date: May 2004
Posts: 2
no, I did not index. thank you for advice.
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