If I look at your query, I suspect the database to be forced to do a tablescan (most likely because of the LIKE). This means that the time spend in the while depends on the number of rows in the table - not just the number of rows returned.
The fact that there's a huge difference if you run it twice in a row only strenghtens my suspicion.