optimize currency query