Use joins instead of multiple lookups in groups sql
Use joins instead of multiple lookups in groups sql

Currently to determine a user's groups (or vice versa) we do
- 1 lookup for the user.
- 1 lookup for the association table.
- n lookups for the n groups the user has.

The association and groups lookup are replaced with a join query.

Fixes: bug 1218675
Change-Id: I560659eda1a30635399829e1c86f06734c90f9e2

dims/keystone,ilay09/keystone,ntt-sic/keystone,promptworks/keystone,MaheshIBM/keystone,openstack/keystone,dsiddharth/access-keys,promptworks/keystone,cloudbau/keystone,jonnary/keystone,openstack/keystone,citrix-openstack-build/keystone,ging/keystone,dsiddharth/access-keys,townbull/keystone-dtrust,blueboxgroup/keystone,townbull/keystone-dtrust,idjaw/keystone,dstanek/keystone,derekchiang/keystone,derekchiang/keystone,jumpstarter-io/keystone,UTSA-ICS/keystone-kerberos,ajayaa/keystone,rickerc/keystone_audit,openstack/keystone,dims/keystone,promptworks/keystone,maestro-hybrid-cloud/keystone,reeshupatel/demo,MaheshIBM/keystone,nuxeh/keystone,citrix-openstack-build/keystone,rodrigods/keystone,idjaw/keystone,vivekdhayaal/keystone,blueboxgroup/keystone,cernops/keystone,rickerc/keystone_audit,reeshupatel/demo,maestro-hybrid-cloud/keystone,ilay09/keystone,townbull/keystone-dtrust,jumpstarter-io/keystone,rodrigods/keystone,jamielennox/keystone,takeshineshiro/keystone,ging/keystone,himanshu-setia/keystone,ilay09/keystone,dstanek/keystone,vivekdhayaal/keystone,cloudbau/keystone,roopali8/keystone,cernops/keystone,reeshupatel/demo,mahak/keystone,takeshineshiro/keystone,nuxeh/keystone,jumpstarter-io/keystone,rushiagr/keystone,jamielennox/keystone,rajalokan/keystone,rushiagr/keystone,dstanek/keystone,nuxeh/keystone,rickerc/keystone_audit,mahak/keystone,klmitch/keystone,ajayaa/keystone,UTSA-ICS/keystone-kerberos,JioCloud/keystone,ntt-sic/keystone,citrix-openstack-build/keystone,JioCloud/keystone,rajalokan/keystone,derekchiang/keystone,cloudbau/keystone,rajalokan/keystone,vivekdhayaal/keystone,ntt-sic/keystone,klmitch/keystone,rushiagr/keystone,mahak/keystone,himanshu-setia/keystone,dsiddharth/access-keys,roopali8/keystone,jonnary/keystone