cancel
Showing results for 
Search instead for 
Did you mean: 

XSJS call prepare the statement on every call

0 Kudos

We have complex logic in Procedure. When I run the procedure from HANA studio is take only 6 sec when executed for the first time and 3-4 sec when executed the second time. The statement is not prepared in the second call.

Second Time :

When I call the same procedure from XSJS it takes 20 seconds every time. ( I am using hdb loadProcedure to call the procedure from XSJS)

procedure = conn.loadProcedure("SCHEMA"."Proecedure");

rs=procedure(input1,input2,....);

I was able to find the find the reason for it, prepare of procedure call takes almost double of execution time and every time the Procedure is called from XSJS it is prepared.

My Questions would be:

  • Does prepare usually take higher time than the execution of the statement? When our logic is complex? I read in HANA developer guide about variable binding, our code follows the guidelines. We use
SELECT column1 from TABLE WHERE cloumn2 = :lv_one  
  • Instead of
SELECT column1 from TABLE WHERE cloumn2 =  1
  • How can I improve the prepare time?.
  • If prepare time is something I have to live with then how can I avoid statement being prepared every time it is called from XSJS?
0 Kudos

I also checked SQL Plan Cache Overview. We have alert which says

For some reason XSJS is not utilizing the SQL Plan Cache

Accepted Solutions (0)

Answers (1)

Answers (1)

lbreddemann
Active Contributor
0 Kudos

If the xsengine runs in its own process this is a known behavior. You could switch it to embedded mode in this case.

0 Kudos

Hi Lars,
This was already implemented by me before asking this question here. It did not help the situation. Moreover, we running on 1.00.122.23