I have a table table1
and the columns are like this:
id - int
field1 - varchar(10)
field2 - varchar(10)
totalMarks - int
Also, I have created an index using the column field1
.
create index myindex1 on table1 (field1);
I need to update the table entries, either using field1
or field2
.
UPDATE table1 SET totalMarks = 1000 WHERE field1='somevalue';
or
UPDATE table1 SET totalMarks = 1000 WHERE field2='somevalue';
Which update query will have good performance? Since we have created an index using field1
, will it have a good performance if we use field1
in the where clause?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…