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?
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?
But for best db performance you want to take advantage of index bracketting as much as possible. Functions in WHERE clauses break that so they generally ought to be avoided. Usually if you need such a structure you probably have an issue with the design of your database -- you probably have a composite field or other relational travesty.
A lot depends here on what MyFunc() does. If it doesn't depend on the values in the record, then execute it before the for each and assign the value to a variable to turn the for each into something simple. If it does depend on the values in the record, then I would do what you could to bracket the for each to the minimum number of records and then do you test on that result set within the for each.
Oh, and could we move back to child of the main post or start a new thread? The deep nesting on this thread is getting tedious to read.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.