Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3353

How to avoid cursor and make more efficient code

$
0
0

Hello HANA experts,

 

We have a problem with a preprocessing procedure. It prepares some data to be processed with R. A simpler version of what we need to do can be summarized as:

 

We have two tables: A and B. We need to do an aggregation from table B for each row in table A, using some table A columns to limit the range of table B rows to be aggregated.

 

As a sample, table A has information of some buildings (construction start, construction end and where it is located), and table B has weather information for the last years for many locations. What we want to do is to aggregate how much it rained during the construction of each building, and add that information to table A.

 

 

Currently we've developed it using a SQLSCRIPT procedure with a cursor, but it takes too long to preprocess the hole table due to the fact that cursors are not parallelized. Thus resulting in a sequential execution of as many aggregation queries as the number of rows in table A.

 

 

Do you have any advise regarding how to make more efficient our preprocessing stage? There is any way to run the aggregation queries in parallel, avoiding the use of the cursor?

 

 

Thanks in advance!

 

 

Juan


Viewing all articles
Browse latest Browse all 3353

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>