Skip to Content
0
May 08, 2008 at 08:17 AM

Runtime of SORT

182 Views

Is there (in)official information on the worst and average case runtime of SORT?

I'd like to determine the values for x and n for which the following code segment:

SELECT fields FROM db_table UP TO n ROWS
  INTO TABLE itab.
SORT itab BY whatever.
DO x TIMES.
  READ TABLE itab WITH KEY key BINARY SEARCH
ENDDO.

outperforms this code segment:

SELECT fields FROM db_table UP TO n ROWS
  INTO TABLE itab.
DO x TIMES.
  READ TABLE itab WITH KEY key.
ENDDO.

(Assuming that exactly n rows are transferred to the internal table.)

Binary search has a worst case runtime of log n. But I need to know if SORT guarantees a runtime boundary like n log n.

--Florian