Manual:$wgMaxExecutionTimeForExpensiveQueries/id

Availability
This was introduced in MediaWiki 1.38.0. It was backported to 1.37.2 1.36.4 1.35.6.