database query optimization

database query optimization