Optimizing
DBMS performance tuning is a multi-level process, and query optimization is only one aspect of it.
Query optimization refers to actions that cause the query optimizer to select the best procedural plan for query execution. This often involves creating or rebuilding the appropriate indexes, updating statistics, etc., i.e. actions that do not involve rewriting the query itself.
To perform this kind of optimization, you need to be able to read a query execution plan and understand how the physical operators that appear in the plan are executed.
Here we will consider slightly different questions, which are more in line with the subject of this e-book. These questions are related to the fact that the same practical task can be solved in different ways, i.e. using different algorithms, then implemented in SQL. Simply speaking, a query can be written in such a way that no optimization will increase its performance to the required level. You can find numerous examples of this on the sql-ex.ru forums, where various solutions to the same task are published. And the optimization stage available on the site is directly related to writing effective queries.