All well-known open-source products (such as MySQL, Spark, and Presto) have optimizers. This article explains the principle of SQL optimizers with an easy-to-understand approach.