Can someone help me with the following:
I'm trying to get the mysql process information (percent complete) to show it to the user in a processbar. I already tried:
SELECT percent_complete
FROM sys.dm_exec_sessions s
INNER JOIN sys.dm_exec_requests r
ON s.session_id = r.session_id
But i keep getting the error that the table sys.dm_exec_sessions s doesnt exist.
As pointed out in comments to the question, sys.dm_exec_requests
view is for ms sql server, it does not exists in MySQL. This is why you get the table not found error.
In MySQL from v5.7.9 the following 4 views in the sys schema provide progress information on long lasting processes:
The 4 views are very similar, just the session related views filter out background processes to display only user sessions, while the processlist views list the background ones as well. In all views the progress
field returns the progress in % (if possible).
SELECT progress
FROM sys.session s