B V, Phanisekhar <[EMAIL PROTECTED]> wrote:
Is it that when a Integer column of a table is defined as primary
key, the it will be part of every index table (rather than rowid)

It's not either-or. Such a column simply becomes an alias for rowid. You can refer to the same column by the name you've given it, or by the name ROWID (and also _ROWID_ and OID).

How does it work when we define a non integer
as primary key.

Then no special aliasing occurs. You have ROWID, and you have that column with a separate index on it. Except for an INTEGER column, PRIMARY KEY is functionally equivalent to UNIQUE NOT NULL.

Assuming in the example given below if we make the
Title column as primary key and create index on Id, how does it
affect the performance of the two queries?

Performance remains the same, but the size of the data becomes larger. First, every row in the table now has three columns - an implicit ROWID, Id and TitleName. Second, since Id is no longer an alias for ROWID, a separate index on Id needs to be created and maintained.

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to