Commit b5c2e85c authored by unknown's avatar unknown

bulk insert optimization documented


mysys/tree.c:
  typo fixed
parent a1826b55
...@@ -20515,8 +20515,6 @@ or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] ...@@ -20515,8 +20515,6 @@ or INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
or INSERT [LOW_PRIORITY | DELAYED] [IGNORE] or INSERT [LOW_PRIORITY | DELAYED] [IGNORE]
[INTO] tbl_name [INTO] tbl_name
SET col_name=expression, col_name=expression, ... SET col_name=expression, col_name=expression, ...
or INSERT [LOW_PRIORITY] [IGNORE] [INTO] tbl_name
SELECT ...
@end example @end example
...@@ -21871,9 +21869,9 @@ The output resembles that shown below, though the format and numbers may ...@@ -21871,9 +21869,9 @@ The output resembles that shown below, though the format and numbers may
differ somewhat: differ somewhat:
@example @example
+-------------------------+---------------------------+ +------------------------------+---------------------------+
| Variable_name | Value | | Variable_name | Value |
+-------------------------+---------------------------+ +------------------------------+---------------------------+
| ansi_mode | OFF | | ansi_mode | OFF |
| back_log | 50 | | back_log | 50 |
| basedir | /my/monty/ | | basedir | /my/monty/ |
...@@ -21896,7 +21894,7 @@ differ somewhat: ...@@ -21896,7 +21894,7 @@ differ somewhat:
| flush_time | 0 | | flush_time | 0 |
| ft_min_word_len | 4 | | ft_min_word_len | 4 |
| ft_max_word_len | 254 | | ft_max_word_len | 254 |
| ft_max_word_len_for_sort| 20 | | ft_max_word_len_for_sort | 20 |
| have_bdb | YES | | have_bdb | YES |
| have_gemini | NO | | have_gemini | NO |
| have_innodb | YES | | have_innodb | YES |
...@@ -21925,6 +21923,7 @@ differ somewhat: ...@@ -21925,6 +21923,7 @@ differ somewhat:
| max_sort_length | 1024 | | max_sort_length | 1024 |
| max_tmp_tables | 32 | | max_tmp_tables | 32 |
| max_write_lock_count | 4294967295 | | max_write_lock_count | 4294967295 |
| myisam_bulk_insert_tree_size | 8388608 |
| myisam_recover_options | DEFAULT | | myisam_recover_options | DEFAULT |
| myisam_sort_buffer_size | 8388608 | | myisam_sort_buffer_size | 8388608 |
| net_buffer_length | 16384 | | net_buffer_length | 16384 |
...@@ -21953,7 +21952,7 @@ differ somewhat: ...@@ -21953,7 +21952,7 @@ differ somewhat:
| tmpdir | /tmp/ | | tmpdir | /tmp/ |
| version | 3.23.29a-gamma-debug | | version | 3.23.29a-gamma-debug |
| wait_timeout | 28800 | | wait_timeout | 28800 |
+-------------------------+---------------------------+ +------------------------------+---------------------------+
@end example @end example
Each option is described below. Values for buffer sizes, lengths, and stack Each option is described below. Values for buffer sizes, lengths, and stack
...@@ -22262,6 +22261,14 @@ The buffer that is allocated when sorting the index when doing a ...@@ -22262,6 +22261,14 @@ The buffer that is allocated when sorting the index when doing a
@code{REPAIR} or when creating indexes with @code{CREATE INDEX} or @code{REPAIR} or when creating indexes with @code{CREATE INDEX} or
@code{ALTER TABLE}. @code{ALTER TABLE}.
@item @code{myisam_bulk_insert_tree_size}
@strong{MySQL} uses special tree-like cache to make bulk inserts (that is,
@code{INSERT ... SELECT},
@code{INSERT ... VALUES (...), (...), ...}, and
@code{LOAD DATA INFILE}) faster. This variable limits
the size of the cache tree in bytes @strong{per thread, per index}.
Default value is 8 MB.
@item @code{myisam_max_extra_sort_file_size}. @item @code{myisam_max_extra_sort_file_size}.
If the creating of the temporary file for fast index creation would be If the creating of the temporary file for fast index creation would be
this much bigger than using the key cache, then prefer the key cache this much bigger than using the key cache, then prefer the key cache
...@@ -23948,8 +23955,8 @@ The following options to @code{mysqld} can be used to change the behavior of ...@@ -23948,8 +23955,8 @@ The following options to @code{mysqld} can be used to change the behavior of
@item @code{-O myisam_sort_buffer_size=#} @tab Buffer used when recovering tables. @item @code{-O myisam_sort_buffer_size=#} @tab Buffer used when recovering tables.
@item @code{--delay-key-write-for-all-tables} @tab Don't flush key buffers between writes for any MyISAM table @item @code{--delay-key-write-for-all-tables} @tab Don't flush key buffers between writes for any MyISAM table
@item @code{-O myisam_max_extra_sort_file_size=#} @tab Used to help @strong{MySQL} to decide when to use the slow but safe key cache index create method. @strong{NOTE} that this parameter is given in megabytes! @item @code{-O myisam_max_extra_sort_file_size=#} @tab Used to help @strong{MySQL} to decide when to use the slow but safe key cache index create method. @strong{NOTE} that this parameter is given in megabytes!
@item @code{-O myisam_max_sort_file_size=#} @tab Don't use the fast sort index method to created index if the temporary file would get bigger than this. @item @code{-O myisam_max_sort_file_size=#} @tab Don't use the fast sort index method to created index if the temporary file would get bigger than this. @strong{NOTE} that this paramter is given in megabytes!
@strong{NOTE} that this paramter is given in megabytes! @item @code{-O myisam_bulk_insert_tree_size=#} @tab Size of tree cache used in bulk insert optimization. @strong{NOTE} that this is a limit @strong{per index}!
@end multitable @end multitable
The automatic recovery is activated if you start @code{mysqld} with The automatic recovery is activated if you start @code{mysqld} with
...@@ -32573,6 +32580,8 @@ Some ways to speed up inserts: ...@@ -32573,6 +32580,8 @@ Some ways to speed up inserts:
If you are inserting many rows from the same client at the same time, use If you are inserting many rows from the same client at the same time, use
multiple value lists @code{INSERT} statements. This is much faster (many multiple value lists @code{INSERT} statements. This is much faster (many
times in some cases) than using separate @code{INSERT} statements. times in some cases) than using separate @code{INSERT} statements.
Tune up @code{myisam_bulk_insert_tree_size} variable to make it even
faster. @xref{SHOW VARIABLES}.
@item @item
If you are inserting a lot of rows from different clients, you can get If you are inserting a lot of rows from different clients, you can get
higher speed by using the @code{INSERT DELAYED} statement. @xref{INSERT, higher speed by using the @code{INSERT DELAYED} statement. @xref{INSERT,
...@@ -46427,6 +46436,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. ...@@ -46427,6 +46436,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet @itemize @bullet
@item @item
Tree-like cache to speed up bulk inserts and
@code{myisam_bulk_insert_tree_size} variable.
@item
Added @code{ALTER TABLE table_name DISABLE KEYS} and Added @code{ALTER TABLE table_name DISABLE KEYS} and
@code{ALTER TABLE table_name ENABLE KEYS} commands. @code{ALTER TABLE table_name ENABLE KEYS} commands.
@item @item
...@@ -313,7 +313,7 @@ int tree_delete(TREE *tree, void *key) ...@@ -313,7 +313,7 @@ int tree_delete(TREE *tree, void *key)
if (remove_colour == BLACK) if (remove_colour == BLACK)
rb_delete_fixup(tree,parent); rb_delete_fixup(tree,parent);
if (tree->free) if (tree->free)
(*tree->free)(ELEMENT_KEY(tree,element)); (*tree->free)(ELEMENT_KEY(tree,element), free_free, tree->custom_arg);
my_free((gptr) element,MYF(0)); my_free((gptr) element,MYF(0));
tree->elements_in_tree--; tree->elements_in_tree--;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment