cancel
Showing results for 
Search instead for 
Did you mean: 

IF else if conditional block leads to bad performance of stored procedure in SAP HANA

Former Member
0 Kudos

Hi All,

In a stored procedure, I have a simple logic,fetch data from a table and update HANA DB table.


When I call the SP it took 5 mins to complete.

Then, I have added load type as input parameter.

If load type = F

Above logic, fetch data from a table and update HANA DB table.

elseif load type D

fetch data from a table and update HANA DB table with some where clause.

endif.

When I call SP with load typ F, now it is running for more than 2 hrs.

Same logic w/o IF CLAUSES completed in 5 mins, and if I put IF clause it took > 2hrs.

Please help me how to resolve this issue?

Thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

rindia
Active Contributor
0 Kudos

Hi Ramya,

Can you paste your code so it will be helpful for others to suggest.

Regards

Raj

Former Member
0 Kudos

I cannot provide actual code. Given pseudo code.

Driving table to update HANA DB table is SAP BW table.

Count of attribute view (AV_SOURCE) = 7,778,211.

Created an attribute view(AV_SOURCE) with inner join b/w two SAP_BW_TABLES.

W/O IF END IF

create procedre test() language sqlscript as

begin
itab1 = select * from AV_SOURCE ;

insert into <HANA_TABLE>

select * from <SAP_BW_TABLE>.

end;

call test().

Completed in 5 mins

With IF END IF

create procedre test(IN load_type,delta_in_days) language sqlscript as

begin

if load_type = 'F'
itab1 = select * from AV_SOURCE ;

insert into <HANA_TABLE>

select * from <SAP_BW_TABLE>.

endif;

end;

call test('F',0).

Running for more than 2 hrs.

Above two SQL's are same except IF clause.

former_member182114
Active Contributor
0 Kudos

Hi Ramya,

I guess you probably hide the evidences when creating the template to post here.

Can't you post more details?

If not I suggest you to turn on the SQL trace trying to understand what is going on inside the box.

Regards, Fernando Da Rós