# Logical Transformation - Column Pruning Example
+ Column pruning assists in minimizing I/O overhead along the execution plan
+ When fewer columns are involved in the query, there are more optimization options available
+ Indexes might be used to fulfill the query, and the table is then bypassed
+ TiFlash might be leveraged for analytical scenarios

```
SELECT name FROM emp WHERE id < 3;
```
![`smart`](ColumnPruning_aa_001_20230922.png)
------------------------------------------------------------------------------
As illustrated on the slide, assume the table includes three columns: `ID`, `NAME`, and `ADDRESS`. If the query only involves the `NAME` and `ID` columns, where the operator reads the `NAME` column and the query utilizes the `ID` column, the `ADDRESS` column can be logically pruned from the entire query execution.

In this context, if there is a composite index on `(ID, NAME)`, how would it affect the execution plan? We'll explore this topic in more depth in Chapter 4.

In the column pruning optimization approach, the optimizer follows the logical execution plan's Abstract Syntax Tree (AST) from top to bottom based on logical order. Each node specifies the columns it requires, the additional columns needed by its parent node, and guides its child nodes accordingly. The nodes collectively accumulate all the columns that need to be computed, and ultimately, at the root node, the necessary columns are determined.

This is also why you should avoid using `*` in the selection list, as it hinders column pruning optimization.