Similar Items: Efficient Cost-Based Rewrite in a Bottom-Up Optimizer