Query Optimization Based on Heuristic Rules