Mysql updates part of the data in batches (and avoids non-repetition)

which is faster, please?
A:

UPDATE vehicle     
        SET driveMileage= CASE vin 
            WHEN "LMVXXXXXX1" THEN 3434 
            WHEN "LMVXXXXXX2" THEN 4345 
            WHEN "LMVXXXXXX3" THEN 5334 
            
            WHEN "LMV9999999" THEN 5333 
        END, 
        updateDatetime= CASE vin 
            WHEN "LMVXXXXXX1" THEN "New Title 1"
            WHEN "LMVXXXXXX2" THEN "New Title 2"
            WHEN "LMVXXXXXX3" THEN "New Title 3"
            
            WHEN "LMV9999999" THEN 5333 
        END
    WHERE vin IN (1,2,3,,9999999)

B:
add "AND state! = "ok"" at the end of A.

An is to update two fields in 1 million rows of data, and B is to add a judgment condition.

Jan.15,2022

if state is not indexed or state is indexed but the cardinality is too small, then it is just as fast, because it is all full table scans

.

if ps: is wrong, please give me some advice

Menu