a7e6b097f9
The OR clause in these queries used different sets of columns to select userid which meant that the indexes that included user id could not be used. This change splits the query so that each individual part can use one of the indexes that includes a userid which speeds them up considerably.