diff options
author | unknown <marko@hundin.mysql.fi> | 2005-04-21 15:02:54 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2005-04-21 15:02:54 +0300 |
commit | 353e499c0d5720fdcb801cd93096dbb898247988 (patch) | |
tree | 6af4105fd3bf72924a33d92c236101be1fe4eb14 /innobase | |
parent | c6b55112b1ca92045f5d8c5ea70c16aea574f4a0 (diff) | |
download | mariadb-git-353e499c0d5720fdcb801cd93096dbb898247988.tar.gz |
InnoDB: Reduce memcpy() load in row_sel_pop_cached_row_for_mysql()
by copying only a prefix of the row that covers the requested
columns.
innobase/include/row0mysql.h:
row_prebuilt_struct: Add field mysql_prefix_len
in order to reduce memcpy() time in
row_sel_pop_cached_row_for_mysql().
innobase/row/row0sel.c:
row_sel_pop_cached_row_for_mysql(): memcpy() only
mysql_prefix_len bytes instead of mysql_row_len.
sql/ha_innodb.cc:
build_template(): Initialize prebuilt->mysql_prefix_len.
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/include/row0mysql.h | 2 | ||||
-rw-r--r-- | innobase/row/row0sel.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/innobase/include/row0mysql.h b/innobase/include/row0mysql.h index e44d689b88b..277089430d4 100644 --- a/innobase/include/row0mysql.h +++ b/innobase/include/row0mysql.h @@ -599,6 +599,8 @@ struct row_prebuilt_struct { that was decided in ha_innodb.cc, ::store_lock(), ::external_lock(), etc. */ + ulint mysql_prefix_len;/* byte offset of the end of + the last requested column */ ulint mysql_row_len; /* length in bytes of a row in the MySQL format */ ulint n_rows_fetched; /* number of rows fetched after diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c index d8c8fa5c2e4..c6171789b8b 100644 --- a/innobase/row/row0sel.c +++ b/innobase/row/row0sel.c @@ -2849,8 +2849,9 @@ row_sel_pop_cached_row_for_mysql( mysql_row_templ_t* templ; byte* cached_rec; ut_ad(prebuilt->n_fetch_cached > 0); + ut_ad(prebuilt->mysql_prefix_len <= prebuilt->mysql_row_len); - if (prebuilt->keep_other_fields_on_keyread) + if (UNIV_UNLIKELY(prebuilt->keep_other_fields_on_keyread)) { /* Copy cache record field by field, don't touch fields that are not covered by current key */ @@ -2877,7 +2878,7 @@ row_sel_pop_cached_row_for_mysql( else { ut_memcpy(buf, prebuilt->fetch_cache[prebuilt->fetch_cache_first], - prebuilt->mysql_row_len); + prebuilt->mysql_prefix_len); } prebuilt->n_fetch_cached--; prebuilt->fetch_cache_first++; |