Reputation:
I have created one table and loaded data. This data was loaded last year.
And today we have created a primary key. Will the primary key
uses row id for the the past records. Or should I rebuild index?
Upvotes: 0
Views: 231
Reputation: 146329
"primary key will create index automatically."
Yes. Unless there is an existing index on the primary key column(s) in which case Oracle will use that to enforce the key. There is no need to rebuild an existing index. This remains true even if the existing index is non-unique (Oracle's clever that way).
"Will the index gets created for past data"
Yes (*). The index applies to all the records in the table, not just ones add after the index is created.
(*) Strictly that should have been 'By default yes' as 12c introduced the concept of partial indexes for partitioned tables. Find out more.
Upvotes: 1