But does this also mean that these lines will be guaranteed to be consistent when I finish?
No. This has nothing to do with transactions, because what you are asking for simply does not exist: relational tables are out of order when querying “sequential rows” is the wrong question. You can rephrase the question as "will 1000 updated lines contain the entire sequence from 1 to 1000, without spaces"? Most likely, yes, but the truth is that there may be gaps depending on how you update. These spaces will not appear because the updated lines change after the update before committing, but since the update will be no-op (no lines will be updated), this is a common problem such as updating to read-modify-write back (the line "disappears" between reading and writing due to parallel operations).
To more accurately answer your question whether your code is correct or not, you need to place the exact code with which the update is performed, as well as the exact structure of the table, including all indexes.
source share