db query efficiency part 1
pulled master