Hello Robert,

a_recipient is dimensioned as VARCHAR(64) thus, it cannot be larger than 64
characters, so the
condition will be useless. Given additionally the fact, that at some places
strings are padded
with blanks (communication up to very recently), I really doubt you can
measure any difference.

Regards
Alexander Schröder
SAP DB, SAP Labs Berlin


-----Original Message-----
From: Robert Klemme [mailto:[EMAIL PROTECTED] 
Sent: Montag, 8. Mai 2006 14:14
To: maxdb
Subject: Efficiency of parameter handling

Hi,

I have this SP:

CREATE DBPROC insert_error_recipient(
   IN a_event_id   FIXED(12),
   IN a_recipient  VARCHAR(64) )
AS
VAR
   l_userid     FIXED(9);
BEGIN
   CALL get_or_create_user_id( :l_userid, NULL, SUBSTR(:a_recipient,
1, 64), NULL );
   INSERT INTO cr_admin.ag_outbound_error_recipients ( eventid,
indexid ) VALUES ( :a_event_id, :l_userid );
END;

Now, since SUBSTR will always extend the string to 64 characters, I
imagine this variant might be more efficient:

CREATE DBPROC insert_error_recipient(
   IN a_event_id   FIXED(12),
   IN a_recipient  VARCHAR(64) )
AS
VAR
   l_userid     FIXED(9);
BEGIN
   IF LENGTH(:a_recipient) > 64 THEN
     CALL get_or_create_user_id( :l_userid, NULL, SUBSTR(:a_recipient,
1, 64), NULL );
   ELSE
     CALL get_or_create_user_id( :l_userid, NULL, :a_recipient, NULL );
 END;
   INSERT INTO cr_admin.ag_outbound_error_recipients ( eventid,
indexid ) VALUES ( :a_event_id, :l_userid );
END;

What do the insiders say?

Kind regards

robert

--
Have a look: http://www.flickr.com/photos/fussel-foto/

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to