‎2009 Mar 24 12:15 PM
hello,
can any one tell me using a query with
SELECT single *
into workarea
from DBtable
where < all fields in the index >
is better or
SELECT *
UP TO 1 ROWS
into warkarea
from DBtable
where < all fields in the index >
Thanks in advance
‎2009 Mar 24 12:23 PM
performancewise they are identical
Use them for better understanding of the coding
SELECT SINGLE, if all keys of an unique index are specified with equal conditions,
i.e. 1 record expected one record read. Works still, if table is buffered.
SELECT UP TO 1 ROWS, special case of UP TO n ROWS, use it when more
rows could, but you are satisfied with one!
Does not work with buffers, but WHERE-condition does also not work with
a single record buffer.
Siegfried
‎2009 Mar 24 12:25 PM
‎2009 Mar 24 12:52 PM
Performence wise both statements are not same.
The Major difference between Select Single and Select UPTO 1 rows is The Usage Of Buffer for each.
Select Single will search for all the satisfied data and bring all that data into Buffer and later it will give to that data to the program.
Select UPTO 1 Rows will end the search after getting the 1st satisfied record and gives that record to the program.
Thus Select Single will take much processing time when compare with Select UPTO 1 rows.
So performrnce wise it is always better to use select up to 1 rows.
Syntax.
select single * from mara into table itab
where condition.
select * from mara up to 1 rows into table itab
where condition.
‎2009 Mar 24 1:27 PM