Mysql 5.7
there are 300 tables in the database. $key = [1...300]
if use UNION ALL, the request is processed 40 seconds.
How to get the row numbers from each