The maximum database query execution timeout for archiving queries defaults to two hours and may also be overridden with a custom timeout value in config.ini.php
When an archiving query exceeds this timeout a 'maximum statement execution time exceeded' exception is returned.
The max execution time exception for archiving queries should be caught and used to trigger an event in the same way that the live query Model::handleMaxExecutionTimeError() method works. This event can then be used to provide notifications that the archiving operation has failed due to query timeout.
We need to make sure the user will be aware if queries run into timeouts.
The goal of this issue is that when you run the archiving using core:archive command, then the archiving will fail and an exception message is shown and it's clear what happened. Ideally also which query caused the issue (if any possible).
The max execution time exception is currently not caught for archiving queries and the archiving operation will silently fail. If an archiving query is slow enough to consistently exceed the timeout then archiving may never complete for some reports and without notification it could be difficult to determine why.
Once this issues is implemented then the FAQ How can I automatically stop long running database queries? will need updating to explain about notification options.