BI Decision

Wednesday, July 12, 2006

Inserting instead of updating

Why don't they teach this in school?

During prototyping or early development, I often want to add a column to a table that already has data in it.

The direct approach is alter table, update column.

Once the table gets bigger than a few hundred thousand rows, the update approach gets slow.

The faster approach is to create a new_table as select * from old_table, drop the old_table, and rename the new_table to the old name.

Why is that faster? Over to Tom Kyte.

0 Comments:

Post a Comment

<< Home