Вопрос

I need to add a new column to at table. I wonder if it is faster to run an alter table query to add the new column and then an update query to insert data in the column. In compare to creating at new table.

I suppose I could just try both to see witch is faster, but maybe someone could explain why?

Это было полезно?

Решение

Point of view speed:

It's more faster create only one column instead of re-creating a table

Point of view data consistence:

A table probabily has a lot of relation with other DB table (it can be a foreign table for others), so if you re-creating a table you must value a script about update other tables reference to your.

I hope, I've answered completely to your question. Have a nice day

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top