optimize activity query