Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-25838

FUNCTION parameters slow execution time dramatically despite DETERMINISTIC

    XMLWordPrintable

Details

    Description

      I know it may not be a bugg.

      Here what I observed:

      CREATE FUNCTION GetName() RETURNS VARCHAR(128)
      DETERMINISTIC
      BEGIN 
      RETURN (SELECT name FROM MyVIEW WHERE id1=26 AND id2=30);
      END
      SELECT GetName();
      

      Execution last few ms.

      CREATE FUNCTION GetName(id_1 INT, id_2 INT) RETURNS VARCHAR(128)
      DETERMINISTIC
      BEGIN 
      RETURN (SELECT name FROM MyVIEW WHERE id1=id_1 AND id2=id_2);
      END
      SELECT GetName(26, 30);
      

      It last more than 8 sec.

      This view is full DETERMINISTIC. What can explain such a gap? Any ways to avoid this?

      Regards,

      Attachments

        Activity

          People

            Unassigned Unassigned
            Gaulué Edouard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.