Would it be slow/inefficient for MySQL to search through potentially thousands of rows for online players?

Or perhaps I could have a separate table that adds a row for users when they come online in-game, and deletes the row when they disconnect, and have the event update if their ID exists in that table? What do you think?

Edit: obviously, when a player disconnects their online time will be saved from the gamemode.