Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy table, with indexes or not?

Status
Not open for further replies.

wolves

Programmer
Jan 26, 2001
130
US
Situation,
have 1 table call it table 1, with 2 indexes, 22mil rows.

Have another table, table 2 exactly the same fields as table 1,except has a new column, and only half the data (11mil rows). 6 indexes (2 the same from table 1, and 4 new indexes).

Bottom line, I need to make table 1 look like table 2, with all the indexes and the new column.

Trying to figure out, if it's easier to just add the new column to table 1, then add the 4 indexes to the table, which could be long?
Or, can I copy the data from table 1 to table 2, so my indexes stay put, then populated the new column with it's appropriate data?

Any suggestions for a non-dba type person?

Thanks in advance.
 
Wolves,

Adding a column to a table is virtually instantaneous since the only thing that changes is the data dictionary...no changes occur to the data blocks themselves.

Creating the four new indexes on Table 1 will be faster by just doing the four "CREATE INDEX..." statements than doing the INSERT alternative you mentioned.

Let us know your thoughts.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)

Do you use Oracle and live or work in Utah, USA?
Then click here to join Utah Oracle Users Group on Tek-Tips.
 
I figured as much. I Always am on the look out for alternative solutions.
Creating indexes on a table with 22mil rows, will take awhile, but at least it can run itself.

Thanks for helping me think out loud here.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top