1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

bulk insert code optimized

mysql-test/r/distinct.result:
  updated
mysql-test/r/fulltext.result:
  updated
mysql-test/r/select.result:
  updated
mysql-test/r/show_check.result:
  updated
mysql-test/t/insert.test:
  updated
This commit is contained in:
unknown
2002-12-07 22:40:20 +01:00
parent 23865c0eea
commit 6271ea35b8
13 changed files with 73 additions and 73 deletions

View File

@@ -105,7 +105,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
int error;
bool log_on= ((thd->options & OPTION_UPDATE_LOG) ||
!(thd->master_access & SUPER_ACL));
bool transactional_table, log_delayed, bulk_insert=0;
bool transactional_table, log_delayed, bulk_insert;
uint value_count;
ulong counter = 1;
ulonglong id;
@@ -187,21 +187,16 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
thd->proc_info="update";
if (duplic == DUP_IGNORE || duplic == DUP_REPLACE)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
if ((bulk_insert= (values_list.elements >= MIN_ROWS_TO_USE_BULK_INSERT &&
lock_type != TL_WRITE_DELAYED &&
!(specialflag & SPECIAL_SAFE_MODE))))
if ((lock_type != TL_WRITE_DELAYED && !(specialflag & SPECIAL_SAFE_MODE)))
{
table->file->extra_opt(HA_EXTRA_WRITE_CACHE,
min(thd->variables.read_buff_size,
table->avg_row_length*values_list.elements));
if (thd->variables.bulk_insert_buff_size)
table->file->extra_opt(HA_EXTRA_BULK_INSERT_BEGIN,
min(thd->variables.bulk_insert_buff_size,
(table->total_key_length +
table->keys * TREE_ELEMENT_EXTRA_SIZE)*
values_list.elements));
table->bulk_insert= 1;
table->file->deactivate_non_unique_index(values_list.elements);
bulk_insert=1;
}
else
bulk_insert=0;
while ((values= its++))
{
@@ -278,7 +273,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
error=1;
}
}
if (table->file->extra(HA_EXTRA_BULK_INSERT_END))
if (table->file->activate_all_index(thd))
{
if (!error)
{
@@ -286,7 +281,6 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, List<Item> &fields,
error=1;
}
}
table->bulk_insert= 0;
}
if (id && values_list.elements != 1)
thd->insert_id(id); // For update log