I need to set all values of a given column foo
to a constant varchar bar
. Is there a faster way to do that than with the vanilla UPDATE mytable SET foo = 'bar'
?
Facts:
- This is an Oracle MySQL 8.0.20 server (via
SELECT @@VERSION
) - This table uses the InnoDB engine
- The column is not part of any index
- The column datatype is
varchar(2000)
. - I can't change the datatypes
- I have full access to the server and could manipulate the
.idb
files directly, if necessary. - The largest table has ~1.7mi records and the regular update takes ~30mins
- Memory, CPU and storage doesn't seem to be a bottleneck, so far (checking
iotop
andhtop
itself)
Note: I need to do similar updates to multiple columns in multiple tables, but what I describe here applies to them all, except for the datatype, which is the worst case (all the other columns are also varchar
, but not that long).