Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

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

$
0
0

As part of my POC converting a SQL Server application over to SAP HANA, I'm find that CALL is taking over 200% more time than calling the SELECT statement directly. The result is that the application that uses ODBC against HANA with CALL statements is taking much more time than SQL Server. I'm finding this for all stored procedure calls in the application. Here is an example:

CREATE PROCEDURE dbo.usp_GetOrdersByCustomerID

(IN C_ID bigint)

LANGUAGE SQLSCRIPT DEFAULT SCHEMA "DBO" READS SQL DATA

AS BEGIN

SELECT  TOP 20

   C_F_NAME,

            C_L_NAME,

            C_EMAIL,

            O_ID,

            O_TOTAL,

            O_DTS,

            O_FM_DTS

FROM    dbo.Customer JOIN dbo.Orders ON C_ID = O_C_ID

WHERE   C_ID = :C_ID

    ORDER   BY O_ID DESC;

END;

 

When using the following CALL statement in SAP HANA Studio

CALL dbo.usp_GetOrdersByCustomerID(3429);

 

 

I get execution times that look like this:

 

Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'

successfully executed in 9 ms 663 µs  (server processing time: 8 ms 115 µs)

Fetched 5 row(s) in 0 ms 69 µs (server processing time: 0 ms 0 µs)

  


Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'

successfully executed in 11 ms 851 µs (server processing time: 8 ms 238 µs)

Fetched 5 row(s) in 0 ms 62 µs (server processing time: 0 ms 0 µs)

 

Statement 'CALL dbo.usp_GetOrdersByCustomerID(3429)'

successfully executed in 8 ms 522 µs  (server processing time: 6 ms 892 µs)

Fetched 5 row(s) in 0 ms 93 µs (server processing time: 0 ms 0 µs)

 

 

 

When I execute the select statement with the hard coded parameter value, I get much faster results:

 

Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'

successfully executed in 4 ms 430 µs  (server processing time: 2 ms 424 µs)

Fetched 5 row(s) in 0 ms 73 µs (server processing time: 0 ms 0 µs)

  


Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'

successfully executed in 4 ms 105 µs  (server processing time: 2 ms 210 µs)

Fetched 5 row(s) in 0 ms 69 µs (server processing time: 0 ms 0 µs)

 

Statement 'SELECT TOP 20 C_F_NAME, C_L_NAME, C_EMAIL, O_ID, O_TOTAL, O_DTS, O_FM_DTS FROM dbo.Customer JOIN ...'

successfully executed in 4 ms 694 µs  (server processing time: 2 ms 810 µs)

Fetched 5 row(s) in 0 ms 60 µs (server processing time: 0 ms 0 µs)

 

 

 

I have 500,000 rows in the Customers table and 2,500,000 rows in the Orders table. The tables are COLUMN tables.

 

Is there an optimization that I'm missing?

Regards,

Bill


Viewing all articles
Browse latest Browse all 6412

Trending Articles



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