Use raw sql for course grade calculation for speed