This should speed up the fixing process.
It may also fix #12185; but I'll need to check against my database without extra indexes.
So ... running this on my test box made the whole thing run slower ... which is probably the opposite of what we wanted.
In my eyes, the problem boils down to the database server needing to perform a full table scan for every single query; and with a large table(mine is upwards of 225 million) this is mind-numbingly slow.
I'd suggest adding a few indexes to the impacted columns, but this would come at the expense of the extra storage for those indexes; and the setup time for them too.