Working out how long a SQL Server backup/restore will take

How to work out how long a SQL Server backup/restore will take using a T-SQL query that will calculate the predicted restore time.

Working out when a database backup or restore operation will take to complete can be a real pain. Fortunately, the sys.dm_exec_requests DMV has some useful columns which can help us predict this. Here’s the query I put together whilst waiting for my backup performance tests to complete: SELECT  r.session_id, CONVERT(NVARCHAR(22),DB_NAME(r.database_id)) AS [database],  r.command AS [backup_process], […]