This is going to cost you in performance, its unavoidable.
What version of Discourse are you running? tests-passed branch?