Skip navigation links

MySQL Forums :: UDF :: UDF v/s literal value


Advanced Search

UDF v/s literal value
Posted by: Jitendra Soni ()
Date: April 09, 2012 09:01AM

Hi,
I am creating a high performance application with MySql as backend. At one place I am not clear that whether I should call a determinitic function returning constast value or better keep it as literal value in query,

Option 1:
literal value
UPDATE UserMaster UM
SET UM.UserStatusID = ActiveUserStatusID()
WHERE U.UserID = UserID
AND U.Email = Email;

CREATE FUNCTION ActiveUserStatusID()
RETURNS tinyint
DETERMINISTIC
BEGIN
RETURN 2;
END

Option 2:
UPDATE UserMaster UM
SET UM.UserStatusID = 2
WHERE U.UserID = UserID
AND U.Email = Email;


We really need high performance and trying to earn from every aspect. I understand managebility can be issue in Option 2, but that is fairly managebaly by process.

Options: ReplyQuote


Subject Views Written By Posted
UDF v/s literal value 1572 Jitendra Soni 04/09/2012 09:01AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.