Re: Use/Dont Use ROWID in queries

From: Reinhard Kuhn <kuhn_at_cas-ps.com>
Date: 1995/12/22
Message-ID: <4bd1ih$7cl_at_fred.cas-ps.com>#1/1


In article <1995Dec21.121807.7261_at_inet.d48.lilly.com>, zahgurim_at_ix.netcom.com says...
>I was told recently that ROWID should not be used in queries since it is not
>unique, especially if the tables are clustered [whatever that means] and you
>loose the rowid when you do an export/import of the data.
>
>I am conufused on this matter and was wondering if anyone could help clarify
>this for me. I always heard that you should use ROWID whenever it is
 possible
>since it's the fastest way to manipulate records and other reasons.

The ROWID of a given row is always unique and is indeed the fastest way to access this row.
However since the ROWID describes the physical location of the row in the datafiles it will most probably not be the same after a table was exported and reimported. Moreover it will certainly be changed, when a row is moved or duplicated by operations like 'insert as select' or 'create table as select'.
So while a ROWID is a perfect unique key at a given moment in time, it can't be _stored_ as a primary or foreign key because it doesn't point to the row itself but to its phyisical location in the database which is not constant. The operations above will alter the rows location and hence the reference to the row will be lost.

Hope this helps

-- 
    _/_/_/   _/_/_/ _/    _/  // Reinhard Kuhn             /  It can be      
   _/    _/ _/     _/  _/    //         (kuhn_at_cas-ps.com) /  done quickly,   
  _/_/_/   _/_/_/ _/_/      // CAS GmbH                  /  cheaply or well  
 _/  _/   _/     _/  _/    // Lemberger Strasse 14      /   - pick any two!  
_/   _/  _/_/_/ _/    _/  // 66955 Pirmasens, Germany  /   
                                   
Received on Fri Dec 22 1995 - 00:00:00 CET

Original text of this message