Re: C++ equivalent type to Oracle's rowid.

From: Robert Klemme <shortcutter_at_googlemail.com>
Date: Tue, 24 Mar 2009 19:49:38 +0100
Message-ID: <72soa0FrmhkjU3_at_mid.individual.net>



On 24.03.2009 13:44, johnbhurley_at_sbcglobal.net wrote: > On Mar 24, 12:00 am, Shane <gshanemil..._at_verizon.net> wrote:
>> What is the C/C++ equivalent to Oracle's rowid?

My spontaneous reaction was "this" which is actually the same concept (storage address). But then I read on and...

>> Currently I am using OTL 4.0 and passing/returning rowids to Oracle
>> stored procedures e.g.:
>>
>> insert into ... values( .. ) returning rowid into rw_id; # returning
>> id
>> update ... set .. where rowid=ord_id; # passing in id
>>
>> Right now my C/C++ type is char[19].
>>
>> As aside I was benchmarking a design which uses a unique primary index
>> to perform the updates like this:
>>
>> update ... ser where order_id=ord_id and order_date=ord_date;
>>
>> vs. a design in which there were NO/ZERO indexes and the update was
>> done like:
>>
>> update ... set .. where rowid=id;
>>
>> Unexpectedly the indexed version generally out performs the rowid
>> approach. I was thinking that passing around 19 byte rowids and/or
>> implicit chartorowid()/rowidtochar() were slowing down the rowid
>> version.

> 
> It has been emphasized for years ( decades even ) to stay away from
> logic operating on/using rowid's ...

In this particular case: it seems you need two database roundtrips when using ROWIDS (i.e. determine the ROWID and then using it for the UPDATE). This is almost always slower than using the WHERE part that was used to determine the ROWID directly in the UPDATE. I don't see the point in using the ROWID here at all.

Kind regards

        robert Received on Tue Mar 24 2009 - 13:49:38 CDT

Original text of this message