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: 

select single vs select upto one rows only by experts

Former Member
0 Kudos
53

Hello Experts,

I am sorry to post this thread again , it is million times answered.

There is a lot of confusion in the answers, so we want a very clear and justifiable answer.

please dont post rubish answers by simply copying and pasting from other threads .

now i will give an example of 2 threads which i seen in the forum.

1) first thread is like this....

According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.

Select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.

2)second post is like this....

When it comes to performance..select ..up to 1 rows is faster than select single....

why?

B'coz, during a select single, the query always hits the database and reads the entire table into memory and fetches the matching single record for you in the memory,

where as in the case of select up to 1 rows, the query goes to the memory first if found it retrieves the record from there, otherwise the query hits the database.

3)i seen an simple example in se30 in tips and tricks it shown select single is having better performance than select upto...rows,

We all really value the best answers..

1 REPLY 1

Former Member
0 Kudos
29

hi this is the standard one from the sdn..which will clear the answer..

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/difference%2bbetween%2bselect%2bsingle%2band...

regards,

venkat