# Best Practices For Columns And Function

+ Bad examples vs good examples

```12
/* Negative */
select gmt_create
from ...
where ~!@date_format(gmt_create,'%Y%m%d %H:%i:%s')@!~ = '20090101 00:00:0'

/* Positive */
select date_format(gmt_create,'%Y%m%d %H:%i:%s')
from .. .
where ~!@gmt_create@!~ = str_to_date('20090101 00:00:00','%Y%m%d %H:%i:s')
```

------------------------------------------------------------
Basic principle: You can use related function on the fetch field, but avoid using any function on the filter field in the Where condition, including data type conversion function, to avoid index invalidation. Alternatively, consider using the expression indexing feature.