Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1304

Stored procedure metadata query slowdown

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.5.6
    • 3.5.9
    • metadata
    • None
    • Mariadb 11.4.5
      A test database with at least 3000+ Stored procedures

    Description

      This issue happens whenever we call a Stored Procedure with at least 1 parameter from Java and we set the parameter using the parameter name e.g.

      String sqlQuery = "{CALL STORED_PROCEDURE_TEST(?)}";
      CallableStatement cStmt = null;
       
      try {
       
         cStmt = connection.prepareCall(sqlQuery);
         cStmt.registerOutParameter("TEST", Types.INTEGER);
         cStmt.execute();
         }
       
      catch (SQLException e) {
      .....
      }
      

      This causes the connector to fire the call

      SELECT * from information_schema.PARAMETERS WHERE SPECIFIC_NAME = 'STORED_PROCEDURE_TEST' AND SPECIFIC_SCHEMA = 'testdb' ORDER BY ORDINAL_POSITION;
      

      This takes ~0.3 seconds and is significantly slower than our previous version of connector J which was 2.7.1 which took ~0.01s
      Note that the previous version did not make this query and instead was using the mysql.proc table i.e.

      select param_list, returns, db, type from mysql.proc where name=? and db=
      

      Another peculiar thing I found is that if you remove the ORDER BY clause in the metadata fetch , the query speeds up by up to 30x. In addition I have checked the Handler_tmp_write and Rows_tmp_read variables:

      • They are both 30000+ with the ORDER BY clause
      • They are 1 without the ORDER BY clause

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            ismetpilev Ismet Pilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

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