fix materialized views through pgbouncer
fix materialized views through pgbouncer

i.e. don't use find_each with an order outside of a transaction

test plan:
 * through pgbouncer
 * with jobs running
 * create a new discussion topic, and access it
 * it should not seem to hang

Change-Id: I1f83497fe482246520c0858f638218e895dfb9c7
Reviewed-on: https://gerrit.instructure.com/23077
Tested-by: Jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@instructure.com>
Reviewed-by: Brian Palmer <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@instructure.com>
Product-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>
QA-Review: Cody Cutrer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@instructure.com>

jay3126/canvas-lms,tgroshon/canvas-lms,arrivu/jigsaw-lms,SwinburneOnline/canvas-lms,efrj/canvas-lms,wimemx/Canvas,juoni/canvas-lms,whalejasmine/canvas-lms,shidao-fm/canvas-lms,venturehive/canvas-lms,usmschuck/canvas,roxolan/canvas-lms,greyhwndz/canvas-lms,samuels410/greatlakes-lms,HotChalk/canvas-lms,wye0220/shindig-canvas,samuels410/greatlakes-lms,merichar/canvas-lms,antoniuslin/canvas-lms,arrivu/hoodemo,samuels410/greatlakes-lms,sfu/canvas-lms,landonwilkins/canvas-lms,arrivu/jigsaw-lms,juoni/canvas-lms,shidao-fm/canvas-lms,ShreniiNepal/shrenii_lmp,usmschuck/canvas,arrivu/hoodemo,leftplusrightllc/canvas-lms,grahamb/canvas-lms,whalejasmine/canvas-lms,Rvor/canvas-lms,grahamb/canvas-lms,djbender/canvas-lms,usmschuck/canvas,SwinburneOnline/canvas-lms,sfu/canvas-lms,roxolan/canvas-lms,usmschuck/canvas,Jyaasa/canvas-lms,loganrun/pincan,wrdsb/canvas-lms,sfu/canvas-lms,antoniuslin/canvas-lms,landonwilkins/canvas-lms,Jyaasa/canvas-lms,djbender/canvas-lms,shidao-fm/canvas-lms,wye0220/shindig-canvas,loganrun/pincan,utkarshx/canvas-lms,fronteerio/canvas-lms,samuels410/greatlakes-lms,whalejasmine/canvas-lms,landonwilkins/canvas-lms,Jyaasa/canvas-lms,sfu/canvas-lms,redconfetti/canvas-lms,kyroskoh/canvas-lms,greyhwndz/canvas-lms,greyhwndz/canvas-lms,antoniuslin/canvas-lms,sdeleon28/canvas-lms,HotChalk/canvas-lms,redconfetti/canvas-lms,kyroskoh/canvas-lms,HotChalk/canvas-lms,merichar/canvas-lms,greyhwndz/canvas-lms,HotChalk/canvas-lms,leftplusrightllc/canvas-lms,utkarshx/canvas-lms,tgroshon/canvas-lms,SwinburneOnline/canvas-lms,roxolan/canvas-lms,loganrun/pincan,tgroshon/canvas-lms,efrj/canvas-lms,djbender/canvas-lms,antoniuslin/canvas-lms,Unow/canvas-lms,ShreniiNepal/shrenii_lmp,arrivu/arrivu-lms,jay3126/canvas-lms,va7map/canvas-lms,va7map/canvas-lms,sdeleon28/canvas-lms,sfu/canvas-lms,Rvor/canvas-lms,shidao-fm/canvas-lms,efrj/canvas-lms,kyroskoh/canvas-lms,djbender/canvas-lms,merichar/canvas-lms,wimemx/Canvas,skmezanul/canvas-lms,wye0220/shindig-canvas,jay3126/canvas-lms,redconfetti/canvas-lms,arrivu/hoodemo,arrivu/jigsaw-lms,landonwilkins/canvas-lms,sfu/canvas-lms,leftplusrightllc/canvas-lms,ShreniiNepal/shrenii_lmp,Jyaasa/canvas-lms,wrdsb/canvas-lms,va7map/canvas-lms,kyroskoh/canvas-lms,arrivu/arrivu-lms,juoni/canvas-lms,grahamb/canvas-lms,Rvor/canvas-lms,sdeleon28/canvas-lms,skmezanul/canvas-lms,SwinburneOnline/canvas-lms,whalejasmine/canvas-lms,juoni/canvas-lms,va7map/canvas-lms,wrdsb/canvas-lms,efrj/canvas-lms,grahamb/canvas-lms,sdeleon28/canvas-lms,fronteerio/canvas-lms,utkarshx/canvas-lms,arrivu/arrivu-lms,venturehive/canvas-lms,redconfetti/canvas-lms,arrivu/qibla-ecampus,jay3126/canvas-lms,grahamb/canvas-lms,wrdsb/canvas-lms,leftplusrightllc/canvas-lms,fronteerio/canvas-lms,tgroshon/canvas-lms,Unow/canvas-lms,skmezanul/canvas-lms,arrivu/qibla-ecampus,Unow/canvas-lms,Rvor/canvas-lms,venturehive/canvas-lms,fronteerio/canvas-lms,skmezanul/canvas-lms,ShreniiNepal/shrenii_lmp,venturehive/canvas-lms,arrivu/qibla-ecampus,utkarshx/canvas-lms,wimemx/Canvas,sfu/canvas-lms,roxolan/canvas-lms