Echo's removeOrphanedEvents.php is run from update.php. At rationalwiki there is an echo_events table with 2.1M rows. When running removeOrphanedEvents.php, each select batch of 500 rows takes 40 seconds, equal to the amount of time to run the query without the limit, due to a poor query plan. So it would take about two days to go through the whole table.
A workaround would be to use event_id BETWEEN $id AND $id+500 instead of just event_id>$id. That way, it doesn't have to tablesort the whole table every time. For now, I have just skipped the update stage.