MySQL Forums
Forum List  »  Newbie

How to find progress of a variable across multiple tables (speed up left join)
Posted by: John Doe
Date: May 16, 2013 07:03AM

Say I have three large tables (over 90,0000 rows) for March, April and May. Each table looks like this.
Name, BOD, Sex, ID, AssetValue

First four columns are used as the primary key (i.e. primary key (Name,BoD,Sex,ID)) in each table.

April table may have more rows than March and, May table may have more rows than April and so on.

I wan to create a new table like this
Name, BOD, Sex, ID, AssetvalueMarch, AssetValue April, AssetvalueMay

Here is what I did. Scan three tables first and create an aggretable that contains all the distinct (Name,Bod,Sex,ID) from three tables. They are primary key in it. This work quite fast.

Then I use left join that table with each of the three tables on (Name,BOD,Sex,ID) one at a time. This takes forever.

Can I approach this problem differently to speed it up?

Thank you in advance for reading this.



Edited 1 time(s). Last edit at 05/16/2013 07:15AM by John Doe.

Options: ReplyQuote


Subject
Written By
Posted
How to find progress of a variable across multiple tables (speed up left join)
May 16, 2013 07:03AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.