In matters of performance is it bad to have functions in the WHERE clause? If yes, can someone explain why, and how could that functionality be replaced by anything less resource hungry?
for each customer where customer.name = substring('somestring',1,8) no-lock:
end.
for each customer where substring(customer.name,1,8) = 'abcdefgh' no-lock:
end.
Because the db engine must fetch each record in the table and apply the function to it. No index can be used to bracket that portion of the query.
A lot depends here on what MyFunc() does.
FOR EACH db.table
WHERE db.table.record = MyFunc(db.table.record2):
END.
FOR EACH db.table:
IF db.table.record = MyFunct(db.table.record2) THEN DO END.
END.