summaryrefslogtreecommitdiff
path: root/innobase/row
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-12-17 13:17:48 +0200
committerunknown <heikki@donna.mysql.fi>2001-12-17 13:17:48 +0200
commitb41e57a70e48ae87d51cd1d7cc18a6ec8641d7ac (patch)
treebbf679c7e6e7f4df6dd459e99b202a5822b46526 /innobase/row
parent56a8ad593e0f951b639b4978d5124b2424defe07 (diff)
downloadmariadb-git-b41e57a70e48ae87d51cd1d7cc18a6ec8641d7ac.tar.gz
dict0mem.c, dict0dict.c, row0mysql.c, dict0mem.h:
Do less statistics calculations for tables dict0mem.h, row0mysql.c: Make calculation of new statistics less frequent, because the statistics in 3.23.44 involves many random disk reads innobase/include/dict0mem.h: Do less statistics calculations for tables innobase/row/row0mysql.c: Do less statistics calculations for tables innobase/dict/dict0dict.c: Do less statistics calculations for tables innobase/dict/dict0mem.c: Do less statistics calculations for tables
Diffstat (limited to 'innobase/row')
-rw-r--r--innobase/row/row0mysql.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index 6baa8f5825d..58bddcfd24a 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -432,19 +432,24 @@ row_update_statistics_if_needed(
row_prebuilt_t* prebuilt) /* in: prebuilt struct */
{
ulint counter;
- ulint old_counter;
- counter = prebuilt->table->stat_modif_counter;
+ counter = prebuilt->table->stat_modified_counter;
- counter += prebuilt->mysql_row_len;
- prebuilt->table->stat_modif_counter = counter;
+ /* Since the physical size of an InnoDB row is bigger than the
+ MySQL row len, we put a safety factor 2 below */
- old_counter = prebuilt->table->stat_last_estimate_counter;
+ counter += 2 * prebuilt->mysql_row_len;
- if (counter - old_counter >= DICT_STAT_CALCULATE_INTERVAL
- || counter - old_counter >=
- (UNIV_PAGE_SIZE
- * prebuilt->table->stat_clustered_index_size / 2)) {
+ prebuilt->table->stat_modified_counter = counter;
+
+ /* Calculate new statistics if 1 / 16 of table has been modified
+ since the last time a statistics batch was run, or if
+ stat_modified_counter > 2 000 000 000 (to avoid wrap-around) */
+
+ if (counter > 2000000000
+ || ((ib_longlong)counter >
+ (UNIV_PAGE_SIZE * prebuilt->table->stat_clustered_index_size)
+ / 16)) {
dict_update_statistics(prebuilt->table);
}
@@ -1019,6 +1024,26 @@ row_create_table_for_mysql(
os_event_set(srv_lock_timeout_thread_event);
}
+ keywordlen = ut_strlen("innodb_mem_validate");
+
+ if (namelen >= keywordlen
+ && 0 == ut_memcmp(table->name + namelen - keywordlen,
+ "innodb_mem_validate", keywordlen)) {
+
+ /* We define here a debugging feature intended for
+ developers */
+
+ printf("Validating InnoDB memory:\n"
+ "to use this feature you must compile InnoDB with\n"
+ "UNIV_MEM_DEBUG defined in univ.i and the server must be\n"
+ "quiet because allocation from a mem heap is not protected\n"
+ "by any semaphore.\n");
+
+ ut_a(mem_validate());
+
+ printf("Memory validated\n");
+ }
+
/* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */