Avoid table scans when using DELETE on a table on which no SELECT has been done.
This commit is contained in:
parent
b0c4b4f252
commit
74708eb4a0
@ -5230,6 +5230,7 @@ shell> cd mysql
|
|||||||
shell> scripts/mysql_install_db
|
shell> scripts/mysql_install_db
|
||||||
shell> chown -R mysql /usr/local/mysql
|
shell> chown -R mysql /usr/local/mysql
|
||||||
shell> chgrp -R mysql /usr/local/mysql
|
shell> chgrp -R mysql /usr/local/mysql
|
||||||
|
shell> chown -R root /usr/local/mysql/bin/
|
||||||
shell> bin/safe_mysqld --user=mysql &
|
shell> bin/safe_mysqld --user=mysql &
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@ -13782,14 +13783,28 @@ This is a synonym for @code{INT}.
|
|||||||
|
|
||||||
A large integer. The signed range is @code{-9223372036854775808} to
|
A large integer. The signed range is @code{-9223372036854775808} to
|
||||||
@code{9223372036854775807}. The unsigned range is @code{0} to
|
@code{9223372036854775807}. The unsigned range is @code{0} to
|
||||||
@code{18446744073709551615}. Note that all arithmetic is done using
|
@code{18446744073709551615}.
|
||||||
signed @code{BIGINT} or @code{DOUBLE} values, so you shouldn't use
|
|
||||||
unsigned big integers larger than @code{9223372036854775807} (63 bits)
|
Some things you should be aware about @code{BIGINT} columns:
|
||||||
except with bit functions! Note that @samp{-}, @samp{+}, and @samp{*}
|
|
||||||
will use @code{BIGINT} arithmetic when both arguments are @code{INTEGER}
|
@itemize @bullet
|
||||||
values! This means that if you multiply two big integers (or results
|
@item
|
||||||
from functions that return integers) you may get unexpected results if
|
As all arithmetic is done using signed @code{BIGINT} or @code{DOUBLE}
|
||||||
the result is larger than @code{9223372036854775807}.
|
values, so you shouldn't use unsigned big integers larger than
|
||||||
|
@code{9223372036854775807} (63 bits) except with bit functions! If you
|
||||||
|
do that, some of the last digits in the result may be wrong because of
|
||||||
|
rounding errors when converting the @code{BIGINT} to a @code{DOUBLE}.
|
||||||
|
@item
|
||||||
|
You can always store an exact integer value in a @code{BIGINT} column by
|
||||||
|
storing it as a string, as there is in this case there will be no
|
||||||
|
intermediate double representation.
|
||||||
|
@item
|
||||||
|
@samp{-}, @samp{+}, and @samp{*} will use @code{BIGINT} arithmetic when
|
||||||
|
both arguments are @code{INTEGER} values! This means that if you
|
||||||
|
multiply two big integers (or results from functions that return
|
||||||
|
integers) you may get unexpected results when the result is larger than
|
||||||
|
@code{9223372036854775807}.
|
||||||
|
@end itemize
|
||||||
|
|
||||||
@cindex floating-point number
|
@cindex floating-point number
|
||||||
@tindex FLOAT
|
@tindex FLOAT
|
||||||
@ -15104,8 +15119,9 @@ All @strong{MySQL} column types can be indexed. Use of indexes on the
|
|||||||
relevant columns is the best way to improve the performance of @code{SELECT}
|
relevant columns is the best way to improve the performance of @code{SELECT}
|
||||||
operations.
|
operations.
|
||||||
|
|
||||||
A table may have up to 16 indexes. The maximum index length is
|
The maximum number of keys and the maximum index length is defined per
|
||||||
256 bytes, although this may be changed when compiling @strong{MySQL}.
|
table handler. @xref{Table types}. You can with all table handlers have
|
||||||
|
at least 16 keys and a total index length of at least 256 bytes.
|
||||||
|
|
||||||
For @code{CHAR} and @code{VARCHAR} columns, you can index a prefix of a
|
For @code{CHAR} and @code{VARCHAR} columns, you can index a prefix of a
|
||||||
column. This is much faster and requires less disk space than indexing the
|
column. This is much faster and requires less disk space than indexing the
|
||||||
@ -15137,6 +15153,7 @@ supported. See @ref{MySQL full-text search} for details.
|
|||||||
|
|
||||||
@cindex multi-column indexes
|
@cindex multi-column indexes
|
||||||
@cindex indexes, multi-column
|
@cindex indexes, multi-column
|
||||||
|
@cindex keys, multi-column
|
||||||
@node Multiple-column indexes, Other-vendor column types, Indexes, Column types
|
@node Multiple-column indexes, Other-vendor column types, Indexes, Column types
|
||||||
@subsection Multiple-column Indexes
|
@subsection Multiple-column Indexes
|
||||||
|
|
||||||
@ -18169,6 +18186,7 @@ error occurs if you try to add a new row with a key that matches an existing
|
|||||||
row.
|
row.
|
||||||
|
|
||||||
@item
|
@item
|
||||||
|
@tindex PRIMARY KEY
|
||||||
A @code{PRIMARY KEY} is a unique @code{KEY} with the extra constraint
|
A @code{PRIMARY KEY} is a unique @code{KEY} with the extra constraint
|
||||||
that all key columns must be defined as @code{NOT NULL}. In @strong{MySQL}
|
that all key columns must be defined as @code{NOT NULL}. In @strong{MySQL}
|
||||||
the key is named @code{PRIMARY}. A table can have only one @code{PRIMARY KEY}.
|
the key is named @code{PRIMARY}. A table can have only one @code{PRIMARY KEY}.
|
||||||
@ -22471,8 +22489,8 @@ used them.
|
|||||||
|
|
||||||
As of @strong{MySQL} Version 3.23.6, you can choose between three basic
|
As of @strong{MySQL} Version 3.23.6, you can choose between three basic
|
||||||
table formats (@code{ISAM}, @code{HEAP} and @code{MyISAM}. Newer
|
table formats (@code{ISAM}, @code{HEAP} and @code{MyISAM}. Newer
|
||||||
@strong{MySQL} may support additional table type, depending on how you
|
@strong{MySQL} may support additional table type (@code{BDB},
|
||||||
compile it.
|
@code{GEMINI} or @code{INNOBASE}), depending on how you compile it.
|
||||||
|
|
||||||
When you create a new table, you can tell @strong{MySQL} which table
|
When you create a new table, you can tell @strong{MySQL} which table
|
||||||
type it should use for the table. @strong{MySQL} will always create a
|
type it should use for the table. @strong{MySQL} will always create a
|
||||||
@ -22547,8 +22565,10 @@ The following is new in @code{MyISAM}:
|
|||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
If @code{mysqld} is started with @code{--myisam-recover}, @code{MyISAM} tables
|
There is a flag in the @code{MyISAM} file that indicates whether or not
|
||||||
will automaticly be repaired on open if the table wasn't closed properly.
|
the table was closed correctly. If @code{mysqld} is started with
|
||||||
|
@code{--myisam-recover}, @code{MyISAM} tables will automaticly be
|
||||||
|
checked and/or repaired on open if the table wasn't closed properly.
|
||||||
@item
|
@item
|
||||||
You can @code{INSERT} new rows in a table without deleted rows,
|
You can @code{INSERT} new rows in a table without deleted rows,
|
||||||
while other threads are reading from the table.
|
while other threads are reading from the table.
|
||||||
@ -22590,16 +22610,12 @@ key. This will improve the space utilization in the key tree.
|
|||||||
@code{NULL} values are allowed in indexed columns. This takes 0-1
|
@code{NULL} values are allowed in indexed columns. This takes 0-1
|
||||||
bytes/key.
|
bytes/key.
|
||||||
@item
|
@item
|
||||||
Maximum key length is now 500 bytes by default. In cases of keys longer
|
Maximum key length is 500 bytes by default (can be changed by
|
||||||
than 250 bytes, a bigger key block size than the default of 1024 bytes
|
recompiling). In cases of keys longer than 250 bytes, a bigger key
|
||||||
is used for this key.
|
block size than the default of 1024 bytes is used for this key.
|
||||||
@item
|
@item
|
||||||
Maximum number of keys/table enlarged to 32 as default. This can be
|
Maximum number of keys/table is 32 as default. This can be enlarged to 64
|
||||||
enlarged to 64 without having to recompile @code{myisamchk}.
|
without having to recompile @code{myisamchk}.
|
||||||
@item
|
|
||||||
There is a flag in the @code{MyISAM} file that indicates whether or not the
|
|
||||||
table was closed correctly. This will soon be used for automatic repair
|
|
||||||
in the @strong{MySQL} server.
|
|
||||||
@item
|
@item
|
||||||
@code{myisamchk} will mark tables as checked if one runs it with
|
@code{myisamchk} will mark tables as checked if one runs it with
|
||||||
@code{--update-state}. @code{myisamchk --fast} will only check those
|
@code{--update-state}. @code{myisamchk --fast} will only check those
|
||||||
@ -35245,7 +35261,7 @@ If your are using the @strong{MySQL} perl DBD module you can read the options
|
|||||||
from the @strong{MySQL} option files. @xref{Option files}.
|
from the @strong{MySQL} option files. @xref{Option files}.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
$dsn = "DBI:mysql:test;mysql_read_default_group=client;"
|
$dsn = "DBI:mysql:test;mysql_read_default_group=client;mysql_read_default_file=/usr/local/mysql/data/my.cnf"
|
||||||
$dbh = DBI->connect($dsn, $user, $password);
|
$dbh = DBI->connect($dsn, $user, $password);
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@ -46448,9 +46464,6 @@ The following problems are known and will be fixed in due time:
|
|||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
@item
|
@item
|
||||||
@code{mysqldump} on a @code{MERGE} table doesn't include the current
|
|
||||||
mapped tables.
|
|
||||||
@item
|
|
||||||
For the moment @code{MATCH} only works with @code{SELECT} statements.
|
For the moment @code{MATCH} only works with @code{SELECT} statements.
|
||||||
@item
|
@item
|
||||||
When using @code{SET CHARACTER SET}, one can't use translated
|
When using @code{SET CHARACTER SET}, one can't use translated
|
||||||
|
@ -156,6 +156,7 @@ int mysql_delete(THD *thd,TABLE_LIST *table_list,COND *conds,ha_rows limit,
|
|||||||
limit != HA_POS_ERROR ? TL_WRITE_LOW_PRIORITY :
|
limit != HA_POS_ERROR ? TL_WRITE_LOW_PRIORITY :
|
||||||
lock_type)))
|
lock_type)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
|
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||||
thd->proc_info="init";
|
thd->proc_info="init";
|
||||||
if (use_generate_table)
|
if (use_generate_table)
|
||||||
DBUG_RETURN(generate_table(thd,table_list,table));
|
DBUG_RETURN(generate_table(thd,table_list,table));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user