Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jasmina_karcic
Creator III
Creator III

Left join (big tables)

Hi experts,

I am loading one table (cca 600 000 000 rows, 20 columns)... It is going pretty quickly. But, I need a new column add to this, from another table. Another table have like 5 000 000 rows. 

It is very slowly if I use left join, what can make it faster?

 

Thank you

 

Jasmina

Labels (1)
  • SaaS

14 Replies
marcus_sommer

Personally I would use mapping like the others already suggested. It avoids all the risks which could occur with joins (adding or removing records depending on the join-type) and it will be surely faster as a join. Further it provides the possibility to define any default-value if there is no match and also to do further calculations at once - and not like by join which would require another load for any further checks/calculations. Also I would look if the mapping-table might not be reduced to a lesser number of records with some kind of advanced filtering. This may look like:

TableForExists: load article from ArticleRawdata where category = 'very important';

/* it's just an example - it may also some generic approach like the recent one from yours (this with the concatenating) with creating the dates from the current year */

ExtractMappingData: load lookup, return from SecondTable where exists(article);

Map: mapping load * resident ExtractMappingData;

drop tables ExtractMappingData, TableForExists;

It may look like expensive efforts but nothing worked better to optimize the load-performance by large datasets - unless you used incremental approaches. In your case with such large tables I would try to implement incremental loadings at first and if it's then further necessary to reduce the load-times the above mentioned approach could be also implemented on top.

- Marcus

jasmina_karcic
Creator III
Creator III
Author

Guys look what I made for this, and it works.

I divide process in 2 parts:

1. I used apply map, to make something like left join and stored in a new qvd.

2. Then I load from that qvd, and make combination of 2 fields, (if column2=0, newcolumn, column2), then i stored in a new qvd.

 

Thank you guys, this is a little slow, but it is okay. Apply Map was helpful.

Regards,

Jasmina

marcus_sommer

I think you could do the second step within the first one, like:

if(column2=0, applymap(), column2)

- Marcus

jasmina_karcic
Creator III
Creator III
Author

Oh I am going to try 😄

jasmina_karcic
Creator III
Creator III
Author

great, this can be 😄

now, 8 min...before was a twice i think 😄