summaryrefslogtreecommitdiff
path: root/sql/ha_heap.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-02-10 02:27:37 +0200
committerunknown <monty@mysql.com>2005-02-10 02:27:37 +0200
commit9f04f9d0352e404cf64e044d1c22873595f276d2 (patch)
tree5b603904b731e515c447d53d7843855bfbbe2f8c /sql/ha_heap.cc
parent70d3ac05d97f7721e564a718ba79afd5eb7eb2cb (diff)
parent0fe1b28b750c12dd500e507f1b688887c9aca227 (diff)
downloadmariadb-git-9f04f9d0352e404cf64e044d1c22873595f276d2.tar.gz
Merge with 4.1
BitKeeper/etc/ignore: auto-union client/mysqltest.c: Auto merged extra/my_print_defaults.c: Auto merged extra/perror.c: Auto merged extra/resolve_stack_dump.c: Auto merged include/help_end.h: Auto merged include/help_start.h: Auto merged myisam/myisamlog.c: Auto merged mysql-test/r/group_by.result: Auto merged mysql-test/r/heap_hash.result: Auto merged BitKeeper/deleted/.del-pack_isam.c~43801f0df7504834: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/user_var.result: Auto merged mysql-test/t/subselect.test: Auto merged ndb/src/kernel/vm/FastScheduler.cpp: Auto merged netware/mysql_test_run.c: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/mysqld.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_select.cc: Auto merged netware/BUILD/nwbootstrap: merge: keep local scripts/make_binary_distribution.sh: merge: keep local sql/ha_heap.cc: Trivial merge sql/ha_innodb.cc: Auto merge (Code already existed in 5.0) sql/item_cmpfunc.cc: Simple merge sql/item_func.cc: Simple merge sql/item_row.cc: Simple merge sql/item_strfunc.cc: Simple merge sql/item_subselect.cc: Merge with sanjas optimzation patch, but keep old code withing ifdef as a reference until this is fixed
Diffstat (limited to 'sql/ha_heap.cc')
-rw-r--r--sql/ha_heap.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index 02d81882e7a..d30435310dc 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -60,8 +60,7 @@ int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
/* Initialize variables for the opened table */
set_keys_for_scanning();
- if (table->s->tmp_table == NO_TMP_TABLE)
- update_key_stats();
+ update_key_stats();
}
return (file ? 0 : 1);
}
@@ -104,6 +103,8 @@ void ha_heap::update_key_stats()
for (uint i= 0; i < table->s->keys; i++)
{
KEY *key=table->key_info+i;
+ if (!key->rec_per_key)
+ continue;
if (key->algorithm != HA_KEY_ALG_BTREE)
{
ha_rows hash_buckets= file->s->keydef[i].hash_buckets;
@@ -124,8 +125,8 @@ int ha_heap::write_row(byte * buf)
if (table->next_number_field && buf == table->record[0])
update_auto_increment();
res= heap_write(file,buf);
- if (!res && table->s->tmp_table == NO_TMP_TABLE &&
- ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
+ if (!res && (++records_changed*HEAP_STATS_UPDATE_THRESHOLD >
+ file->s->records))
update_key_stats();
return res;
}
@@ -137,8 +138,8 @@ int ha_heap::update_row(const byte * old_data, byte * new_data)
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
res= heap_update(file,old_data,new_data);
- if (!res && table->s->tmp_table == NO_TMP_TABLE &&
- ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
+ if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD >
+ file->s->records)
update_key_stats();
return res;
}