Which one is best [message #198676] |
Wed, 18 October 2006 04:08 |
selvakumar_82
Messages: 138 Registered: October 2005 Location: chennai
|
Senior Member |
|
|
Hi Friends,
I have one doubt,,,,pls clear it
I have more than one crore datas in a table.
I want to add one column in a table ( 'Defalut' as defalut)
Which method is best..
1.Creating a new table and copying all the data
2. adding one more column.
Thanx and regards
Selva
|
|
|
|
|
|
|
Re: Which one is best [message #198790 is a reply to message #198738] |
Wed, 18 October 2006 09:40 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
>> I'm to blame too: I was too lazy to look it up in Wikipedia Embarassed
Nope. I don't think so.
It is not your(our) responsibility to decipher a local slang.
It is the responsibility of the OP to post in international standards in an *international* web forum.
In many cases, folks were just unware of that and when pointed would get corrected.
So it is nobodys fault.
Coming back to the thread,
>>CTAS or ALTER TABLE? What is the fastest.
As usual it depends.
10 million records is kinda mid-average.
A simple ALTER TABLE add column may be enough.
It depends on the usage of the column ( or how to update the column with what value?).
In this case some default value is used on the new column and that would be very painful (because
that will update every row).
In that case a new table would be better.
create a new_table from old_table with just the structure (no data).
Add the new_column to the new_table (with default specifications).
insert into new_table from old_table along with APPEND hint.
drop the old_table. rename new_table to old_table.
recreate indexes/constraints. collect stats
[Updated on: Thu, 19 October 2006 09:16] Report message to a moderator
|
|
|