Remove Subtransactions in Event
Background
In #338346 (comment 652623314) and #338865 (comment 655312474), we identified the use of subtransactions can cause significant performance issues on PostgreSQL replicas at scale. If a long running transaction occurs, the subtransaction cache may not fit into the working set of memory, which can lead to a context switch storm when PostgreSQL needs to load subtransaction data from disk. While this arguably is a PostgreSQL bug, we should remove subtransactions entirely because they aren't performant at GitLab.com scale, nor are they strictly necessary. More context in https://gitlab.slack.com/archives/C02BHCTH02D/p1629392215352100?thread_ts=1629388693.342800&cid=C02BHCTH02D.
Problem to solve
From Thanos you can see Event
is generating subtransactions. These should be removed from the codebase asap: