perf-improve: speed up query