change php backend query more effective