Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

performance issue-open sql vs native sql

ankit_doshi
Participant
0 Kudos
152

Hello,

I have a scenario where the select statement is fetching around 3 Lac 300,000 records from database table and we have 3 such select statements all of which are written using open sql, will converting them into native sql help me improve the performance?

Message was edited by: Thomas Zloch

3 REPLIES 3

ThomasZloch
Active Contributor
0 Kudos
75

No, you would give up the built-in optimisation techniques of the database interface (DBI).

Your description is very vague, add more details like the actual open SQL statement, existing indexes, results of ST05 SQL-trace.

Thomas

0 Kudos
75

Hi Thomas,

I thought that if I use native SQL, the DBI would not require to convert the open SQL into Native SQL and thus it would save some time and eventually add to the performance. I was not pretty sure about it and so I started this discussion. I am looking for generic replies only, I browsed the net and did not find much about performance related topics for open/native sql.

It would be a simple select query with about 3-4 conditions in where clause, but the amount of data fetched would be huge.

0 Kudos
75

Hi,

whatever SQL it is, it will be compiled long before the execution, otherwise you will not be able to start the program. At runtime the statement will be parsed, which is some kind of machine-language for the database. At this time the access plan will be compiled. This will be in the range of twens of micro seconds. So I guess in terms of performance, there will be no benefit in general.

I had a usefull scenario once, where i could make use of a rownum-limited ordered subselect result set on an ORACLE DB. But this might be a rare case.

Native SQL is usefull, when you need to us DB features that are not codable in open SQL.

Volker