table index

update t set f1 = 'xxx' where f1 = 'yyy';


the sql above is a little slow, which cost 11s, after analyzing, t.f1 doesn't have a index on it.
so I tried to add index to it, but it's slower, cost 22s.
after discussing with DBA, who told me the reason for slower is that if index was created on this column, this update not only do update work, but also update index data for this column.
in all, this kind of sql don't need to setup index.

猜你喜欢

转载自zgq456.iteye.com/blog/2040734