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 of SELECT Statements

Former Member
0 Kudos

Hi All,

I have a small confusion.

Consider these 3 statements :

A.

SELECT * from table1 where {conditions based on primary key}.

exit.

Endselect.

B.

SELECT SINGLE * from table1 where {conditions based on primary key}.

C.

SELECT upto 1 rows from table1 where {conditions based on primary key}.

Considering that table1 has more than 1 primary keys,Which statement gives the best peformance when

1.All the keys are used in the where condition.

2.Only a few keys are used in the where condition

Thanks in advance.

Hari

4 REPLIES 4

Former Member
0 Kudos

for all conditions option B gives the best performance.

Former Member
0 Kudos

Hi,

If you are interested in only one record then

1.All the keys are used in the where condition.

Ans B

2.Only a few keys are used in the where condition

Ans C

santhosh

Former Member
0 Kudos

hi

in all cases option B will give best performance.

first option will give very poor performance

(checked)

valter_oliveira
Active Contributor
0 Kudos

In situation 1 it's definitly B. In situation 2 I would say "a mix of C and A", like:

SELECT field1 ... fieldn from table1 UP TO 1 ROWS where {conditions based on primary key}.

exit.

Endselect.

Regards,

Valter Oliveira.