Leumas
Leumas

Reputation: 15

Reducing execution time of MySQL UPDATE

I want to optimize the execution time (50 sec) of the following update command.

    UPDATE matches a
    JOIN players AS b 
    ON a.player1_name = b.player_name
    SET a.player1_id = b.id
    WHERE a.player1_id = 0

The table matches has approximately 10000 entries and table players 4000 entries.

Upvotes: 1

Views: 133

Answers (1)

Philip Devine
Philip Devine

Reputation: 1169

Make sure you have indexes on a.player1_name, b.player_name and a.player1_id.

Upvotes: 1

Related Questions