Improve querying efficiency again.