Isso deve fazer o truque:
SELECT
@s := @s + (@prev_size != a.size) `index`,
id,
@prev_size := a.size size,
name
FROM a, (SELECT @s := 0, @prev_size := -1) s
ORDER BY a.size
Resultado:
| INDEX | ID | SIZE | NAME |
|-------|----|------|------|
| 1 | 2 | 200 | bcd |
| 1 | 5 | 200 | aaa |
| 2 | 3 | 400 | xyz |
| 3 | 1 | 500 | abc |
| 3 | 4 | 500 | bbb |
Fiddle aqui .