Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-485

improve performance : binary query resultset

    XMLWordPrintable

Details

    • Task
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      benchmarking different driver, it seems there is some performances part that can be improved :

                                                            |--------------|--------------|--------------|--------------|
                                                            | c            | c            | odbc         | odbc         |
                                                            | mysql        | mariadb      | mariadb      | mysql        |
      ------------------------------------------------------|--------------|--------------|--------------|--------------|
      Select 100 int cols            - BINARY EXECUTE ONLY  | 14007 |  69% | 20198 | 100% |  7466 |  37% |  8858 |  44% |
      ------------------------------------------------------|--------------|--------------|--------------|--------------|
      

      C code :

       
      void select_100_int_cols_prepared(benchmark::State& state, MYSQL* conn, MYSQL_STMT* stmt) {
        int rc;
        int int_data[100];
        unsigned long length[100];
       
        MYSQL_BIND my_bind[100];
        memset(my_bind, 0, sizeof(my_bind));
       
        for (int i = 0; i < 100; i++) {
          my_bind[i].buffer_type= MYSQL_TYPE_LONG;
          my_bind[i].buffer= (char *) &int_data[i];
          my_bind[i].length= &length[i];
        }
       
        rc = mysql_stmt_execute(stmt);
        check_conn_rc(rc, conn);
       
        rc = mysql_stmt_bind_result(stmt, my_bind);
        check_stmt_rc(rc, stmt, conn);
       
        rc = mysql_stmt_store_result(stmt);
        check_stmt_rc(rc, stmt, conn);
       
        while (mysql_stmt_fetch(stmt)) {
          //
        }
      }
      

      odbc code :

          ret = SQLExecute(stmt);
          if (!SQL_SUCCEEDED(ret)) {
            check_error(stmt, SQL_HANDLE_STMT, "Execute SELECT 100 int cols failed");
          }
          
          SQLINTEGER values[100];
          if (SQLFetch(stmt) == SQL_SUCCESS) {
            for (int i = 0; i < 100; i++) {
              SQLGetData(stmt, i + 1, SQL_C_SLONG, &values[i], 0, NULL);
            }
          }
          
          SQLCloseCursor(stmt);
      

      MySQL driver is even faster.
      Columns metadata are normally cached, so it is expected to be way faster than mysql connector
      secondly, there must be normally very few difference with c performance, but this is only around 1/3 of c driver. maybe the metadata are converted without needed ?

      Attachments

        Activity

          People

            Lawrin Lawrin Novitsky
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.