The given query selects 10 random rows and then returns the unique_id of the row with the highest price among them. However, using ORDER BY RAND() is very expensive when the table has a large number of rows.
To optimize this, we can:
Pick a random offset within the table.
Retrieve 10 consecutive rows starting from that offset.