Is it safe to create an index on an existing table in oracle?
Like this:
CREATE INDEX table_sample_ix03
ON table_sample
(
col4,
col22
)
TABLESPACE data
STORAGE
(
INITIAL 10M NEXT 2M
MINEXTENTS 1 MAXEXTENTS 100
PCTINCREASE 0
)
;
Yes. But if possible, you should do it while no one is updating the table, because they would suffer performance-wise (it is still safe to do it anyway, there will be no data corruption).
To create a new index for a table, you use the CREATE INDEX statement as follows: CREATE INDEX index_name ON table_name(column1[,column2,...]) Second, specify the name of the table followed by one or more indexed columns surrounded by parentheses.
The CREATE INDEX statement is used to create indexes in tables. Indexes are used to retrieve data from the database more quickly than otherwise. The users cannot see the indexes, they are just used to speed up searches/queries.
You can also create an index for a cluster. You can create a composite index on multiple columns up to a maximum of 32 columns. A composite index key cannot exceed roughly one-half (minus some overhead) of the available space in the data block.
The ONLINE clause is recommended when you create the index while DML queries are being run on the table. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_5010.htm
Example:
CREATE INDEX "MYINDEX" ON "MYTABLE" ("MYCOLUMN") ONLINE;
Yes. But if possible, you should do it while no one is updating the table, because they would suffer performance-wise (it is still safe to do it anyway, there will be no data corruption).
Yes. Why wouldn't it be?
I can only think of possible performance issues just after issuing the command. If the table is very large, the indexing can take some time but other than that, it should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With