RegisterSign In
By Rob Bygrave (rbygrave) on Aug 20, 2009 3:14 PM.
SDBRow - able to get something like a 'physical row id'
I'm thinking it would be useful from a client code perspective to be able to get something like a 'physical row id' from a given SDBRow.

That is, say you iterate and find rows you are interested in. For some rows you return the data back to the client... but sometimes you just want to return an id so that you can read that row data later (in another request).

Now you could just return the value from the 'primary key column' ... but that would mean you need to go back to the index to get the location of the SDBRow. An alternative would be to be able to use a 'physical row id' (the location of the SDBRow that is in the index?) ... and if you could do this then you would not have to go back to the index and instead go directly to the SDBRow.

This would probably only work with a 'primary key' type of index? Could have something like:

SDBRow row = SDBTable.getSDBRow(.. physical row id...)

From my perspective this is purely a performance optimisation ... being able to skip going back to the index.
By Tobias Downer (toby) on Aug 20, 2009 3:48 PM.
The SDBRow object is basically just storing a row_id. The trouble with exposing the actual row_id value is that it may change. When you modify a row and during a transaction merge the row_id can change.

I'm not sure if there is much to be gained, performance wise, by exposing the row_id value. You can hold onto SDBRow objects if you don't want to go back and query the index all the time, or you could use a RowCursor and do positional fetches of row objects on a view of the index. I think you'll find this will be good performance. Traversing with a RowCursor or creating SDBRow objects will not cause much interaction with the stored data - these operations will only fetch the relevant parts of the index you are traversing and won't touch the data stored in the row. The system will only interact with the data store when you call SDBRow.getValue(column) provided the data isn't in the cache.
Please sign in or register to post in this topic.
The text on this page is licensed under the Creative Commons Attribution 3.0 License. Java is a registered trademark of Oracle and/or its affiliates.
Mckoi is Copyright © 2000 - 2019 Diehl and Associates, Inc. All rights reserved.