Good afternoon, please tell me, please, what is a SARG argument and how does the optimizer use it?
Answer 1, Authority 100%
Sarg = Seekable Argument, such an argument, when substituting which the WHERE
condition allows you to use the index. For example:
select * from mytable where id = 3;
will be able to use the idling index, and:
select * from mytable where (id * 3) = 3;
No, since it will take to multiply each ID value in the table, which is equivalent to the complete coupling. Nonsarg can greatly slow down the execution of your queries, especially often such arguments are obtained as a result of a custa cable to another type.