Reverted some of my previous changes. The main culprit of slowness was related to the SQLAlchemy _enable_transaction_accounting flag being set to True. This was basically causing it to iterate over many items.
Coverage increased (+0.06%) to 68.286% when pulling 3688220684bebd11f6739cfcd2e291ffaf94ae58 on perf into e20e06391aee3064a3260f72a4feb3b8880a0f7c on develop.
Reverted some of my previous changes. The main culprit of slowness was related to the SQLAlchemy
_enable_transaction_accounting
flag being set toTrue
. This was basically causing it to iterate over many items.