CockroachDB custom-built our cost-based SQL query optimizer a few years ago, and we've been improving it ever since.