This query is very slow, taking about 1 second per record. Sadly, for (and because of) the size of the database, this is untenable as it will take days to complete.
Can you suggest a way to speed it up substantially? (I only need to run it once, but in a <1hr window ideally)
update participants set start_time = (select min(time_stamp)
from tasks where participant_id = participants.participant_id)
I don’t think we need full table descriptions to suggest a more sensible query structure, but I can post them if required. The database is mysql.
Many thanks.
You would need to make sure there is an index on tasks.participant_id. Depending on the number of tasks per participant (if there are really many) you could also add an index on time_stamp, although I don’t know if MySQL would make use of it.