Hi,
The question is - can a scalar function, for example MAX, be used in WHERE clause for SELECT? Could anypone please guide on this.
Any help is appreciated.
Can a scalar function, for example MAX, be used in WHERE...
-
- Website Team
- Posts: 100
- Joined: Sun May 12, 2013 12:33 am
- Anuj Dhawan
- Founder
- Posts: 2803
- Joined: Sun Apr 21, 2013 7:40 pm
- Location: Mumbai, India
- Contact:
Re: Can a scalar function, for example MAX, be used in WHERE
Hi,
The answer is Yes, but there is a "but" to consder here - one should limit the usage of Scalar functions such as SUBSTR, CHAR, INT etc. in the WHERE clause. This is advised because if any scalar function is used for a column in the WHERE clause, the DB2 optimizer will not use a matching index column for the retrieval of the records from the table - and it turn, the response time of your LUW gets slow.
The answer is Yes, but there is a "but" to consder here - one should limit the usage of Scalar functions such as SUBSTR, CHAR, INT etc. in the WHERE clause. This is advised because if any scalar function is used for a column in the WHERE clause, the DB2 optimizer will not use a matching index column for the retrieval of the records from the table - and it turn, the response time of your LUW gets slow.
Thanks,
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Anuj
Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
-
- Website Team
- Posts: 100
- Joined: Sun May 12, 2013 12:33 am
Re: Can a scalar function, for example MAX, be used in WHERE
Thanks Anuj - this helps a lot!
Regards,
Anjali
Anjali
Re: Can a scalar function, for example MAX, be used in WHERE
Hello Anuj,
What do you mean by:
Thanks!
Maidy
What do you mean by:
Linux, Unix and Windows?the response time of your LUW gets slow.
Thanks!
Maidy
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute