Skip to Content
0
Former Member
May 30, 2008 at 06:37 PM

select single vs select upto one rows only by experts

24 Views

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..