Rowid Recid - Forum - OpenEdge General - Progress Community
 Forum

Rowid Recid

  • whats the difference between rowid and recid ?

  • whats the difference between rowid and recid ?

    Do you have access to the product documentation?

    RECID: Returns the unique internal identifier of the database record currently associated with the record buffer you name. This internal identifier has the data type RECID, a four-byte value that is supported by OpenEdge databases and some non-OpenEdge DataServers.

    This function is supported for backward compatibility. For most applications, use the ROWID function, instead. For more information, see the ROWID function reference entry.

    Returns the unique internal identifier of the database record currently associated with the record buffer you name. This internal identifier has the data type ROWID, which is supported for OpenEdge and all other DataServer databases.

    The ROWID data type is a variable-length byte string capable of representing a record identifier for any DataServer database.

  • Anyone who has access to this forum has access to the product documentation ... using it may be another issue!

    Consulting in Model-Based Development, Transformation, and Object-Oriented Best Practice  http://www.cintegrity.com

  • Anyone who has access to this forum has access to the product documentation ... using it may be another issue!

    But wouldn't that be too simple?

  • DISCLAIMER : WHAT FOLLOWS IS PROBABLY UNSUPPORTED

    For OpenEdge databases the string representation of a rowid is the hex representation of the recid.

    Following (.Net only) methods converts a recid to rowid. Unfortunately OpenEdge does not provide a supported built-in method to do this.

    This works in OpenEdge 10.2B, the number of digits may be different for other versions, I have not checked this.

        method public static rowid ToRowid(input iRecid as recid):
            return ToRowid(int64(iRecid)).
        end method.


        method public static rowid ToRowid(input iRecid as int64):

            define variable HexValue as character no-undo.

            hexValue = lc(System.Convert:ToString(iRecid,16)).
            hexValue = "0x" + fill("0", 16 - length(HexValue)) + HexValue.

            return to-rowid(HexValue).

        end method.

    The .Net requirement is easily removed but I needed it only in a .Net context.

  • mmmmmm, I seem to remember that RECID are not guaranteed to be unique

    within a database with type II storage area, but rowids are

    Database gurus would be better placed to comment, but be very very

    careful about recids

    On 22 December 2011 09:07, Carl Verbiest

  • Hi Julian,

    According to the manual both are unique per area, not within a database. The same value can appear in every area.

    RECID A RECID is a unique internal identifier for a record within a single database storage area.
    Note: RECID is supported mainly for backward compatibility. For most applications, use ROWID instead.
    ROWID A ROWID is a unique internal identifier for a record within a single database storage area.

  • A recid is an encoded form of the storage location of a database record.

    A rowid is an encoded form of the storage location of a database record.

    At one time in the past, recids were 32 bits long and could be cast into integers and vice versa. Now they can be up to 64 bits long. So can integers.

    rowids were a variable length bit string from their inception and cannot be cast into integers. Plans changed after that. since we made recids capable of being up to 64 bits long, except for the part about casting to integer, for OpenEdge databases, recid and rowid are now the exact same thing.

    Message was edited by: Gus Bjorklund

  • they are more or less interchangeable except for the conversion to/from integers.

    At one time, a recid was unique within an entire database.

    In version 9.0 through 10.2, they are unique only within a data storage area.

    From version 11.0 on, in multi-tenant tables they are unique only within a single tenant's table data partition. Two tenants can each have the same rowid for their records in a table.

    A record's recid/rowid is constant for the life of the record. It is assigned when a record is created and a storage location for it is chosen. It will not change when the record is updated. It /will/ change if the record is deleted and then created again.

    Although they are not, you should behave as though recid/rowids are randomly generated values.

  • as of 10.1B, recid/rowids are not 4 bytes for the OpenEdge RDBMS. They are variable lenght and can be up to 8 bytes long now.

  • see. I told you that the db guys know more than I did

    On 22 December 2011 14:25, Gus Bjorklund

  • Hello Gus,

    you stated "A record's recid/rowid is constant for the life of the record". I remember in former times, when a record grows, it may be relocated. Will this not change recid/rowid? Or is this now different (split instead of relocation)?

    I assume a DB without partitioning and Multi-Tenancy... :)

    kind regards

    Klaus

  • In the meantime horizontal table partitioning has been implemented. When a record’s (key) value is value is changed causing the record to be moved to a different partition will also result in a new rowid/recid for that record.

    Architect of the SmartComponent Library and WinKit

    Consultingwerk Ltd.

  • Mike, I know :)

    That's why I added  that I assume no partitioning :)

    So short and hopefully clear question is: Is there relocation of records or not. And if yes, how can the rowid be stable.

  • > I remember in former times, when a record grows, it may be relocated.

    The first fragment of record always keeps the same recid.