Re: ROWIDs ???
Posted in 2001
"Lucky Leavell [RIS]" wrote: > > Version 7.31 > OS: AIX 4.3.3 > > I am fairly new to the Informix 4GL world and notice a lot of the extant > programs use ROWID to access/update rows in tables. Is this considered a > good programming practice? (Ingres had the concept of TIDs - tuple IDs - > but dtrongly recommended against their use.) It would seem to be a better > practice to use a primary key (e.g., employee number) instead... comments? Using rowid's in 4GL is very good practice. Always was and still is. The ONLY exception is if you are accessing fragmented tables then the table can have duplicate rowid values. Even then you can add a pseudo rowid using the ALTER TABLE command which adds a sort of SERIAL column. However, having said all that, if you are setting your coding standards now, I would recommend using the primary key for all access to tables. There are several reasons: Using rowid has specific and limited use. Using rowid is not portable to other DBS's. Using the table's primary key adds consistency for all access and follows database design. rowid will not work with fragmented tables. If you add pseudo rowid's, they are no faster than primary key access. The only thing I would add is make sure you have a good database design, and avoid composite primary keys if possible. ;-) Cheers, -- Mark. +----------------------------------------------------------+-----------+ | Mark D. Stock mailto:mdstock@mydas.freeserve.co.uk |//////// /| | http://www.informix.com http://www.informixhandbook.com |///// / //| | http://www.iiug.org +-----------------------------------+//// / ///| | |This email will self-destruct in |/// / ////| | |10 sec. If you received this email |// / /////| | |in error, sorry about the mess. |/ ////////| +----------------------+-----------------------------------+-----------+