I've got a column 'updatetime' that's a timestamp ("2011-02-01 09:00:51"). For performance reasons I have to create an indexed column 'updatetime_hour' in line with the hour from the timestamp.

So for instance if 'updatetime' was "2011-02-01 09:00:51" then 'updatetime_hour' could be "9".

I am trying to get this done all in mysql though PHP is definitely an option too. 60k+ existing rows.

Ideas?

UPDATE yourtable SET updatetime_hour=HOUR(updatetime);

Don't run this in peak hrs, it will require some time. You can even run it in more compact batches - make updatetime_hour nullable and continue running this, before you get " rows affected":

UPDATE yourtable SET updatetime_hour=HOUR(updatetime)
   WHERE updatetime_hour IS NULL LIMIT 1000;

To get this done instantly every time you add or update a row, use triggers:

CREATE TRIGGER t1 BEFORE INSERT ON table
FOR EACH ROW BEGIN
    SET NEW.updatetime_hour = HOUR(NEW.updatetime);
END
CREATE TRIGGER t2 BEFORE UPDATE ON table
FOR EACH ROW BEGIN
    SET NEW.updatetime_hour = HOUR(NEW.updatetime);
END