Selinger (et al.) paper on the cost-based optimizer.