If I have an index, for example, by CD_CLIENT, CD_COMMOD, CD_MERCAD, and there is a query that uses them with TRIM. So:
.......
WHERE
TRIM( CUSTOMER_CD ) = ...
AND TRIM(CD_COMMOD) = ...
AND TRIM(CD_MARKET) = ...
Should I make another index that has the TRIM ?
Or is that enough?
Thank you very much!!
Should I make another index that has the TRIM ?
Yes!
Applying any function to a column in the WHERE limits the optimizer's ability to use indexes on them.
TRIM is a function
=> This limits the optimizer's ability to use indexes.
That said, a better solution would be to avoid using TRIM() altogether - assuming this is possible.