This is a semi-blocker to T116317 as it causes the queries to be slow & annoying to work with & do testing on. Basically there are some indexes we need to add.
The main challenge with adding indexes is that they then get added by upgrade later & we either get duplicates or it causes the upgrade to fail.
I'm going to catch up with Tim on that see