section api: pull some queries outside of transactions to try to fix deadlocks