Application Development and Automation 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: 

SELECT syntax for speed

kenmelching
Active Contributor
717

What is faster in a SELECT....WHERE statement?

objnr+0(2) IN ('PR','NV')

or

(objnr LIKE 'PR%' OR objnr LIKE 'NV%')

5 REPLIES 5

roberto_forti
Contributor
604

Hi, consider working with below transactions to analyze it

1. SE30 or SAT (Runtime Analysis) transaction

2. ST05 - SQL Trace (Performance Trace) transaction

Attached documentation about SQL Trace

https://wiki.scn.sap.com/wiki/display/SAPSQL/How+to+run+transaction+st05+to+trace+a+program%2C+trans...

Regards,

0 Kudos
604

Hi Ken Melching, let us know the results. Regards

matt
Active Contributor
0 Kudos
604

Did you consider writing a couple of programs to find out? And then maybe publishing a blog with the use case, why it's important to you and the results?

Sandra_Rossi
Active Contributor
0 Kudos
604

It depends on the type of database you are using, not ABAP.

Is objnr+0(2) permitted in OpenSQL now?

P14397410
Participant
0 Kudos
604

Ken,

objnr+0(2) IN ('PR','NV')

Above syntax is disallowed (at least when Oracle is the database). If that is allowed in your installation, it should be easy to write a test program and check for yourself. You can use GET TIME STAMP statement to measure the time.

DATA: l_timestamp_1 TYPE timestampl,
      l_timestamp_2 TYPE timestampl,
      l_time        TYPE timestampl,

      t_covp        TYPE STANDARD TABLE OF covp.

GET TIME STAMP FIELD l_timestamp_1.

SELECT  *
INTO   TABLE t_covp
FROM   covp
UP TO  100 ROWS
WHERE  objnr LIKE 'PR%' OR objnr LIKE 'NV%'.

GET TIME STAMP FIELD l_timestamp_2.

l_time = l_timestamp_2 - l_timestamp_1.
WRITE: / l_timestamp_1, / l_timestamp_2, / l_time.