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

Some InnoDB counters are duplicating generic SHOW STATUS

Details

    Description

      The InnoDB srv_stats counters n_rows_updated, n_rows_deleted, n_rows_inserted, and n_rows_read are duplicating Handler_update, Handler_delete, Handler_write, and various Handler_read_ counters.

      Updating those counters is not free, especially because some counters are furthermore split to distinguish a rare case of modifying tables in the system schema:

      		if (table->is_system_db) {
      			srv_stats.n_system_rows_updated.inc(size_t(trx->id));
      		} else {
      			srv_stats.n_rows_updated.inc(size_t(trx->id));
      		}
      

      On a related note, handler::increment_statistics() which updates the common status variables, does not employ any caching or sharding whatsoever. It could be better to first update the counters directly in handler data members and only update global counts at the end of each statement.

      Attachments

        Issue Links

          Activity

            Tingynia Tingyao Nian added a comment -

            Add my comment here same as MDEV-31772:

            Are the handler* counters specifically for combination of all storage engines or just InnoDB? If the server uses more than 1 storage engine (ie. InnoDB and RockDB), then the handler* variables would not be a precise reflection for InnoDB at all? Please let me know if I'm misunderstand something.

            Tingynia Tingyao Nian added a comment - Add my comment here same as MDEV-31772 : Are the handler* counters specifically for combination of all storage engines or just InnoDB? If the server uses more than 1 storage engine (ie. InnoDB and RockDB), then the handler* variables would not be a precise reflection for InnoDB at all? Please let me know if I'm misunderstand something.

            The Handler_update, Handler_delete, Handler_write status variables as well as the various Handler_read_ counters indeed cover access to any storage engine. In information_schema.rocksdb_trx you can apparently find a transaction-level write_count but nothing on reads.

            For internal temporary tables that may be used by operations like JOIN, ORDER BY or GROUP BY, there are separate counters Handler_tmp_delete, Handler_tmp_update, Handler_tmp_write, and nothing on reads.

            marko Marko Mäkelä added a comment - The Handler_update , Handler_delete , Handler_write status variables as well as the various Handler_read_ counters indeed cover access to any storage engine. In information_schema.rocksdb_trx you can apparently find a transaction-level write_count but nothing on reads. For internal temporary tables that may be used by operations like JOIN , ORDER BY or GROUP BY , there are separate counters Handler_tmp_delete , Handler_tmp_update , Handler_tmp_write , and nothing on reads.

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              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.