{
r.last();
count = r.getRow();
}

My hope is, that last() instructs the kernel to move the cursor to the last row, and therefor the traffic won't be that much.
Yes, but *only* this. Actually calling 'getRow' while being
on the 'last' row uses some tricks, which may or may not be performant enough. Its performance depends heavily on
the particular strategy chosen by the database to create
the result, and what you have done on the result before.
(Fetching through the result, and afterwards using that
sequence above is quite more performant as doing it as first operation).
i have about 600 results (not that much, but might get bigger), and i only need 20 records. afterward i need to know the whole number of records that was avaible.

so the thing i want to do is:
r.absolute(n) //jump to starting point
r.next() //about 20 times
//get row count

Is there a more sapdb-optimized version to get the number of rows returned by a select-statement?
No. If you look at other DBMS', you will see that getRow() is always relatively expensive.
Hmmm, should it be possible to "count" the rows that have been passed to the application although that would have to pay attention to any absolute/relative/etc. calls

If you want only the number, there is no need for selecting the data => use a "SELECT COUNT(...) ...", if you need to handle the data you have to live with the fact that
DBMS usually only know the result count when they have built up
the result completely.
How about
  SELECT rowno, ... FROM ... JOIN ... WHERE ...

and using
  r.last();
  int count = r.getInt(1);

Would this work better than using getRow()?


_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to