开发者

UPDATE - which index follow?

开发者 https://www.devze.com 2023-02-26 01:24 出处:网络
I\'d like to know from where-to where the UPDATE start and finish. Always from the lowest key to the high one? Or could update row in t开发者_运维百科he middle before update the first ones?It\'s usual

I'd like to know from where-to where the UPDATE start and finish. Always from the lowest key to the high one? Or could update row in t开发者_运维百科he middle before update the first ones?


It's usually some unknown function of the WHERE clause in the UPDATE but nothing is guaranteed, so don't count on anything, however...
You can add a order by clause to your update statement, like so:

UPDATE mytable SET mytable.myfield = mytable.id + 1 ORDER BY id;

Then the update statement will run from the lowest to the highest id.


it is undefined. the entire transaction will be read consistent from the first update to the first commit.

0

精彩评论

暂无评论...
验证码 换一张
取 消