-1

My sql based db, I know that adding more rows causes re-indexing which slows down write operation.

If I just add an additional column, and I push update queries on these rows such that it's adding values into empty column, will my write performance be impacted in this case? Because my index is still based on PK so that's not changing.

Dale K
  • 25,246
  • 15
  • 42
  • 71
user2430771
  • 1,326
  • 4
  • 17
  • 33

1 Answers1

0

Adding a column will generally require rewriting the data. This can depends on the database you are using and the type of the column, but think that space needs to be reserved for the column on each data page.

If you modify columns that are not parts of indexes, then in general you are pretty safe from impacts on indexes.

There is one exception where something could occur. Some columns (such as strings) have a variable size. If the new value does not fit on a page, then the page needs to be split. This split slows down the update and would also affect indexes.

This should not happen for updates to fixed-size columns -- generally numbers, date/times, and char() values in most databases.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786