Use a UNION for User.find_by_any_email
Use a UNION for User.find_by_any_email

This is significantly faster than using a sub-query, at least when run
on the GitLab.com production database. The benchmarks are a lot slower
now with these changes, most likely due to PostgreSQL choosing a
different (and less efficient) plan based on the amount of data present
in the test database.

Thanks to @dlemstra for suggesting the use of a UNION.

dreampet/gitlab,axilleas/gitlabhq,martijnvermaat/gitlabhq,openwide-java/gitlabhq,mr-dxdy/gitlabhq,yatish27/gitlabhq,dreampet/gitlab,LUMC/gitlabhq,SVArago/gitlabhq,martijnvermaat/gitlabhq,larryli/gitlabhq,darkrasid/gitlabhq,allysonbarros/gitlabhq,axilleas/gitlabhq,ksoichiro/gitlabhq,Datacom/gitlabhq,dplarson/gitlabhq,jirutka/gitlabhq,htve/GitlabForChinese,screenpages/gitlabhq,iiet/iiet-git,jrjang/gitlabhq,koreamic/gitlabhq,mmkassem/gitlabhq,ikappas/gitlabhq,dreampet/gitlab,cui-liqiang/gitlab-ce,mrb/gitlabhq,iiet/iiet-git,SVArago/gitlabhq,shinexiao/gitlabhq,dwrensha/gitlabhq,dplarson/gitlabhq,axilleas/gitlabhq,dplarson/gitlabhq,jrjang/gitlab-ce,jrjang/gitlab-ce,LUMC/gitlabhq,t-zuehlsdorff/gitlabhq,dreampet/gitlab,jrjang/gitlabhq,ksoichiro/gitlabhq,htve/GitlabForChinese,koreamic/gitlabhq,daiyu/gitlab-zh,ttasanen/gitlabhq,t-zuehlsdorff/gitlabhq,louahola/gitlabhq,louahola/gitlabhq,mr-dxdy/gitlabhq,openwide-java/gitlabhq,LUMC/gitlabhq,Soullivaneuh/gitlabhq,louahola/gitlabhq,duduribeiro/gitlabhq,shinexiao/gitlabhq,mmkassem/gitlabhq,screenpages/gitlabhq,stoplightio/gitlabhq,stoplightio/gitlabhq,yatish27/gitlabhq,koreamic/gitlabhq,allysonbarros/gitlabhq,ikappas/gitlabhq,screenpages/gitlabhq,iiet/iiet-git,dwrensha/gitlabhq,dplarson/gitlabhq,openwide-java/gitlabhq,icedwater/gitlabhq,allysonbarros/gitlabhq,t-zuehlsdorff/gitlabhq,mr-dxdy/gitlabhq,LUMC/gitlabhq,martijnvermaat/gitlabhq,jirutka/gitlabhq,martijnvermaat/gitlabhq,mmkassem/gitlabhq,axilleas/gitlabhq,ksoichiro/gitlabhq,htve/GitlabForChinese,larryli/gitlabhq,mrb/gitlabhq,mmkassem/gitlabhq,Datacom/gitlabhq,ferdinandrosario/gitlabhq,mr-dxdy/gitlabhq,openwide-java/gitlabhq,ttasanen/gitlabhq,Datacom/gitlabhq,daiyu/gitlab-zh,jrjang/gitlab-ce,stoplightio/gitlabhq,jrjang/gitlabhq,darkrasid/gitlabhq,ferdinandrosario/gitlabhq,mrb/gitlabhq,Soullivaneuh/gitlabhq,icedwater/gitlabhq,shinexiao/gitlabhq,darkrasid/gitlabhq,ferdinandrosario/gitlabhq,jrjang/gitlab-ce,duduribeiro/gitlabhq,koreamic/gitlabhq,larryli/gitlabhq,allysonbarros/gitlabhq,icedwater/gitlabhq,dwrensha/gitlabhq,louahola/gitlabhq,ikappas/gitlabhq,ferdinandrosario/gitlabhq,ksoichiro/gitlabhq,SVArago/gitlabhq,cui-liqiang/gitlab-ce,Datacom/gitlabhq,Soullivaneuh/gitlabhq,duduribeiro/gitlabhq,ttasanen/gitlabhq,t-zuehlsdorff/gitlabhq,jirutka/gitlabhq,cui-liqiang/gitlab-ce,jirutka/gitlabhq,ikappas/gitlabhq,yatish27/gitlabhq,stoplightio/gitlabhq,jrjang/gitlabhq,duduribeiro/gitlabhq,screenpages/gitlabhq,daiyu/gitlab-zh,icedwater/gitlabhq,htve/GitlabForChinese,darkrasid/gitlabhq,dwrensha/gitlabhq,ttasanen/gitlabhq,cui-liqiang/gitlab-ce,daiyu/gitlab-zh,SVArago/gitlabhq,shinexiao/gitlabhq,iiet/iiet-git,Soullivaneuh/gitlabhq,mrb/gitlabhq,larryli/gitlabhq,yatish27/gitlabhq