https://github.com/mozilla/bugbug/blob/f131cbd85919266bb2e33db2dd9f8f0cc0646c2c/scripts/retrieve_try_pushes.py#L67 this greatly reduces the runtime of the queries and the load on the treeherder DB.
bugbug/scripts/retrieve_try_pushes.py
Line 67 in f131cbd