The select_number field inside st_select_lex is only required for EXPLAIN functionality. Hence, it can probably be generated locally inside select_describe() and related functions. The select_number field in st_select_lex object and the global counter in thd/ lex can thus be eliminated.
