improve performance of terms page
improve performance of terms page

it was doing a table scan on enrollments, so by adding a condition of
the root account, it can use an index

performance improvement is from 2 seconds to 50ms

test plan:
 * ensure user counts on terms page doesn't change

Change-Id: I98b25c97b34671537dd7254ec690ffc57bd4c512
Reviewed-on: https://gerrit.instructure.com/11046
Tested-by: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
Reviewed-by: Brian Palmer <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@instructure.com>

juoni/canvas-lms,sdeleon28/canvas-lms,redconfetti/canvas-lms,Unow/ins,Jyaasa/canvas-lms,sdeleon28/canvas-lms,ankithbti/canvas_lms,djbender/canvas-lms,instructure/canvas-lms,icelab/canvas,wye0220/shindig-canvas,dgynn/canvas-lms,ShreniiNepal/shrenii_lmp,Unow/ins,landonwilkins/canvas-lms,sfu/canvas-lms,leftplusrightllc/canvas-lms,instructure/canvas-lms,wrdsb/canvas-lms,nditech/red-innovadores-lms,nditech/red-innovadores-lms,narigone/canvas,arrivu/hiring-site,snehakachroo1/LSI_replica,juoni/canvas-lms,instructure/canvas-lms,greyhwndz/canvas-lms,whalejasmine/canvas-lms,wrdsb/canvas-lms,sdeleon28/canvas-lms,samuels410/greatlakes-lms,sfu/canvas-lms,nditech/red-innovadores-lms,skmezanul/canvas-lms,Jyaasa/canvas-lms,AndranikMarkosyan/lms,arrivu/arrivu-lms,merichar/canvas-lms,skmezanul/canvas-lms,utkarshx/canvas-lms,efrj/canvas-lms,shidao-fm/canvas-lms,gbleydon/canvas-lms,arrivu/hoodemo,loganrun/pincan,HotChalk/canvas-lms,gbleydon/canvas-lms,ShreniiNepal/shrenii_lmp,usmschuck/canvas,sli7246/canvas_branch,instructure/canvas-lms,AndranikMarkosyan/lms,Jyaasa/canvas-lms,redconfetti/canvas-lms,wimemx/Canvas,snehakachroo1/LSI_replica,greyhwndz/canvas-lms,gbleydon/canvas-lms,merichar/canvas-lms,grahamb/canvas-lms,usmschuck/canvas,parbros/red-innovadores-lms,eCNAP/CANVAS,samuels410/greatlakes-lms,arrivu/jigsaw-lms,sfu/canvas-lms,nditech/red-innovadores-lms,roxolan/canvas-lms,fronteerio/canvas-lms,rup/Tarrax,jay3126/canvas-lms,utkarshx/canvas-lms,wimemx/Canvas,narigone/canvas,samuels410/greatlakes-lms,eCNAP/CANVAS,ankithbti/canvas_lms,shidao-fm/canvas-lms,icelab/canvas,arrivu/jigsaw-lms,grahamb/canvas-lms,Unow/canvas-lms,landonwilkins/canvas-lms,leftplusrightllc/canvas-lms,Unow/ins,djbender/canvas-lms,arrivu/hoodemo,ShreniiNepal/shrenii_lmp,arrivu/qibla-ecampus,juoni/canvas-lms,va7map/canvas-lms,wrdsb/canvas-lms,arrivu/hiring-site,arrivu/qibla-ecampus,venturehive/canvas-lms,tgroshon/canvas-lms,venturehive/canvas-lms,leftplusrightllc/canvas-lms,narigone/canvas,whalejasmine/canvas-lms,kyroskoh/canvas-lms,wye0220/shindig-canvas,eCNAP/CANVAS,SwinburneOnline/canvas-lms,sfu/canvas-lms,whalejasmine/canvas-lms,roxolan/canvas-lms,instructure/canvas-lms,venturehive/canvas-lms,sfu/canvas-lms,HotChalk/canvas-lms,wimemx/Canvas,kyroskoh/canvas-lms,skmezanul/canvas-lms,arrivu/jigsaw-lms,usmschuck/canvas,shidao-fm/canvas-lms,Unow/canvas-lms,SwinburneOnline/canvas-lms,antoniuslin/canvas-lms,ankithbti/canvas_lms,Rvor/canvas-lms,redconfetti/canvas-lms,instructure/canvas-lms,roxolan/canvas-lms,dgynn/canvas-lms,sfu/canvas-lms,grahamb/canvas-lms,arrivu/arrivu-lms,antoniuslin/canvas-lms,jay3126/canvas-lms,grahamb/canvas-lms,icelab/canvas,va7map/canvas-lms,antoniuslin/canvas-lms,efrj/canvas-lms,fronteerio/canvas-lms,tgroshon/canvas-lms,arrivu/hiring-site,matematikk-mooc/canvas-lms,parbros/red-innovadores-lms,sli7246/canvas_branch,tgroshon/canvas-lms,HotChalk/canvas-lms,wrdsb/canvas-lms,arrivu/arrivu-lms,snehakachroo1/LSI_replica,jay3126/canvas-lms,Rvor/canvas-lms,merichar/canvas-lms,juoni/canvas-lms,SwinburneOnline/canvas-lms,arrivu/qibla-ecampus,leftplusrightllc/canvas-lms,fronteerio/canvas-lms,Rvor/canvas-lms,wye0220/shindig-canvas,eCNAP/CANVAS,Rvor/canvas-lms,sdeleon28/canvas-lms,dgynn/canvas-lms,rup/Tarrax,rup/Tarrax,efrj/canvas-lms,AndranikMarkosyan/lms,utkarshx/canvas-lms,matematikk-mooc/canvas-lms,va7map/canvas-lms,narigone/canvas,landonwilkins/canvas-lms,kyroskoh/canvas-lms,sfu/canvas-lms,sli7246/canvas_branch,greyhwndz/canvas-lms,loganrun/pincan,greyhwndz/canvas-lms,parbros/red-innovadores-lms,antoniuslin/canvas-lms,snehakachroo1/LSI_replica,tgroshon/canvas-lms,SwinburneOnline/canvas-lms,ShreniiNepal/shrenii_lmp,djbender/canvas-lms,venturehive/canvas-lms,AndranikMarkosyan/lms,roxolan/canvas-lms,redconfetti/canvas-lms,dgynn/canvas-lms,va7map/canvas-lms,grahamb/canvas-lms,arrivu/hoodemo,Jyaasa/canvas-lms,usmschuck/canvas,efrj/canvas-lms,jay3126/canvas-lms,matematikk-mooc/canvas-lms,instructure/canvas-lms,skmezanul/canvas-lms,fronteerio/canvas-lms,djbender/canvas-lms,matematikk-mooc/canvas-lms,utkarshx/canvas-lms,whalejasmine/canvas-lms,shidao-fm/canvas-lms,Unow/canvas-lms,kyroskoh/canvas-lms,loganrun/pincan,HotChalk/canvas-lms,samuels410/greatlakes-lms,landonwilkins/canvas-lms