simplfuzz
simplfuzz

Reputation: 12915

MySql Add Index : 0 Rows Affected

Alter table table1 add index col1_idx (column1);

Even though the table1 has many rows and all of the have non null values for column1, the above query says "0 Rows AFfected". Why could this be?

Upvotes: 8

Views: 3413

Answers (1)

alexn
alexn

Reputation: 59002

That is because the query is not directly affecting any rows as opposed to an update statement where you modify the row. It (very, very, very basically) only changes how the column is stored and sorted.

Upvotes: 7

Related Questions