Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2895

Re: Calling an SP takes over 200% more time over the select statement

$
0
0

Hi Yiming,

     My recent testing with shows much improvement with stored procedure execution with SPS10. The difference between execution of a SELECT statement and the same one within a stored procedure is now within 10 ms. Here is a little example using the sflight sample schema running within SAP HANA Studio.

 

DO
BEGIN

DECLARE starttime timestamp;
DECLARE endtime timestamp;
starttime = CURRENT_UTCTIMESTAMP;


select count(*) FROM sflight.sbook;


endtime =  CURRENT_UTCTIMESTAMP;
SELECT
  :starttime AS "Start Time"
  , :endtime AS "End Time"
  , NANO100_BETWEEN( :starttime, :endtime)/10000 AS "Elapsed Time (ms)" FROM DUMMY;
END;

 

The time comes back around 2ms

 

Next, I create an SP

CREATE PROCEDURE sflight.sbook_count AS

BEGIN

select count(*) FROM sflight.sbook;

END;

 

Then wrap the call with the timing code

DO
BEGIN

DECLARE starttime timestamp;
DECLARE endtime timestamp;
starttime = CURRENT_UTCTIMESTAMP;


call sflight.sbook.count();


endtime =  CURRENT_UTCTIMESTAMP;
SELECT
  :starttime AS "Start Time"
  , :endtime AS "End Time"
  , NANO100_BETWEEN( :starttime, :endtime)/10000 AS "Elapsed Time (ms)" FROM DUMMY;
END;

 

The timing results in this case are identical  at 2ms. I've noticed that longer running queries could have a variation of 10 ms, but it was well within the margin of error.

 

When I was at TechEd this year, the product team indicated they made improvements in SPS10 and it looks to be the case.

 

I'd be happy to check out what you are doing in your MSSQL migration project as this is what I do :-)

 

Regards,

Bill


Viewing all articles
Browse latest Browse all 2895

Trending Articles