Commit 73af125e authored by jcole@tetra.spaceapes.com's avatar jcole@tetra.spaceapes.com
Browse files

Merge jcole@work.mysql.com:/home/bk/mysql

into tetra.spaceapes.com:/usr/home/jcole/bk/mysql
parents 036dfc00 1148accf
Loading
Loading
Loading
Loading
+92 −24
Original line number Diff line number Diff line
@@ -581,7 +581,7 @@ Speed of queries that access or update data
* Estimating performance::      Estimating query performance
* SELECT speed::                Speed of @code{SELECT} queries
* Where optimizations::         How MySQL optimizes @code{WHERE} clauses
* LEFT JOIN optimization::      How MySQL optimizes @code{LEFT JOIN}
* LEFT JOIN optimization::      How MySQL optimizes @code{LEFT JOIN} and @code{RIGHT JOIN}
* LIMIT optimization::          How MySQL optimizes @code{LIMIT}
* Insert speed::                Speed of @code{INSERT} queries
* Update speed::                Speed of @code{UPDATE} queries
@@ -3886,7 +3886,15 @@ Canada [Tryc] @
@c Added 980312
@c @image{Flags/usa}
USA [Hurricane Electric/San Jose] @
@uref{http://mysql.he.net, WWW}
@uref{http://mysql.he.net/, WWW}
@item
@c EMAIL: ask@valueclick.com (Ask Bjoern Hansen)
@c Added 20000925
@c @image{Flags/usa}
USA [ValueClick, Los Angeles CA] @
@uref{http://mysql.valueclick.com/, WWW}
@uref{ftp://mysql.valueclick.com/mysql/, FTP}
@c @item
@c Not ok 20000919; Non-existent (Matt)
@@ -9109,7 +9117,7 @@ almost always sorted. In 3.23, you must use @code{GROUP BY} or
@code{SUM()} now returns @code{NULL}, instead of 0, if there is no matching
rows. This is according to ANSI SQL.
@item
New restricted words: @code{CASE, THEN, WHEN, ELSE and END}
New restricted words: @code{CASE, THEN, WHEN, ELSE, END and RIGHT}
@item An @code{AND} or @code{OR} with @code{NULL} values will now return
@code{NULL} instead of 0. This mostly affects queries that uses @code{NOT}
on an @code{AND/OR} expression as @code{NOT NULL} = @code{NULL}.
@@ -16564,10 +16572,22 @@ DROP DATABASE [IF EXISTS] db_name
@code{DROP DATABASE} drops all tables in the database and deletes the
database.  @strong{Be VERY careful with this command!}
@code{DROP DATABASE} returns the number of files that were removed from the
database directory.  Normally, this is three times the number of tables,
because each table corresponds to a @file{.MYD} file, a @file{.MYI} file and a
@file{.frm} file.
@code{DROP DATABASE} returns the number of files that were removed from
the database directory.  Normally, this is three times the number of
tables, because normally each table corresponds to a @file{.MYD} file, a
@file{.MYI} file and a @file{.frm} file.
The @code{DROP DATABASE} command removes from the given database
directory all files with the following extensions:
@multitable @columnfractions .25 .25 .25 .25
@item .BAK @tab .DAT @tab .HSH @tab .ISD
@item .ISM @tab .ISM @tab .MRG @tab .MYD
@item .MYI @tab .db  @tab .frm
@end multitable
All sub directories that consists of 2 digits (@code{RAID} directories)
are also removed.
In @strong{MySQL} 3.22 or later, you can use the keywords @code{IF EXISTS} to
prevent an error from occurring if the database doesn't exist.
@@ -17772,6 +17792,10 @@ store a blob in a file.
@findex LEFT OUTER JOIN
@findex NATURAL LEFT JOIN
@findex NATURAL LEFT OUTER JOIN
@findex RIGHT JOIN
@findex RIGHT OUTER JOIN
@findex NATURAL RIGHT JOIN
@findex NATURAL RIGHT OUTER JOIN
@findex STRAIGHT_JOIN
@node JOIN, INSERT, SELECT, Reference
@section @code{JOIN} syntax
@@ -17788,6 +17812,9 @@ table_reference LEFT [OUTER] JOIN table_reference join_condition
table_reference LEFT [OUTER] JOIN table_reference
table_reference NATURAL [LEFT [OUTER]] JOIN table_reference
@{ oj table_reference LEFT OUTER JOIN table_reference ON conditional_expr @}
table_reference RIGHT [OUTER] JOIN table_reference join_condition
table_reference RIGHT [OUTER] JOIN table_reference
table_reference NATURAL [RIGHT [OUTER]] JOIN table_reference
@end example
Where @code{table_reference} is defined as
@@ -17844,7 +17871,7 @@ mysql> select table1.* from table1
This example finds all rows in @code{table1} with an @code{id} value that is
not present in @code{table2} (i.e., all rows in @code{table1} with no
corresponding row in @code{table2}).  This assumes that @code{table2.id} is
declared @code{NOT NULL}, of course.
declared @code{NOT NULL}, of course. @xref{LEFT JOIN optimization}.
@item
The @code{USING} @code{(column_list)} clause names a list of columns that must
@@ -17867,6 +17894,11 @@ semantically equivalent to a @code{INNER JOIN} or a @code{LEFT JOIN}
with a @code{USING} clause that names all columns that exist in both
tables.
@item
@code{RIGHT JOIN} works analogously as @code{LEFT JOIN}.  To keep code
portable across databases, it's recommended to use @code{LEFT JOIN}
instead of @code{RIGHT JOIN}.
@item
@code{STRAIGHT_JOIN} is identical to @code{JOIN}, except that the left table
is always read before the right table. This can be used for those (few)
@@ -18211,9 +18243,11 @@ files directly, because the contents of the file must travel from the client
host to the server host.  On the other hand, you do not need the
@strong{file} privilege to load local files.
Note that you can't read from a FIFO with @code{LOAD DATA INFILE}; If
you need to read from a FIFO (for example the output from gunzip), use
@code{LOAD DATA LOCAL INFILE} instead.
@c old version
If you are using @strong{MySQL} before 3.23.24 you can't read from a
FIFO with @code{LOAD DATA INFILE}; If you need to read from a FIFO (for
example the output from gunzip), use @code{LOAD DATA LOCAL INFILE}
instead.
@cindex @code{mysqlimport}
You can also load data files by using the @code{mysqlimport} utility; it
@@ -18627,7 +18661,7 @@ well. If you get warnings and want to know exactly why you got them, one way
to do this is to use @code{SELECT ... INTO OUTFILE} into another file and
compare this to your original input file.
If you need @code{LOAD DATA INFILE} to read from a pipe, you can use the
If you need @code{LOAD DATA} to read from a pipe, you can use the
following trick:
@example
@@ -18637,6 +18671,9 @@ cat < /dev/tcp/10.1.1.12/4711 > /nt/mysql/db/x/x
mysql -e "LOAD DATA INFILE 'x' INTO TABLE x" x
@end example
If you are using and older @strong{MySQL} version than 3.23.25
you can only do the above with @code{LOAD DATA LOCAL INFILE}.
For more information about the efficiency of @code{INSERT} versus
@code{LOAD DATA INFILE} and speeding up @code{LOAD DATA INFILE},
@xref{Insert speed}.
@@ -25631,7 +25668,7 @@ mysql> SELECT ... FROM tbl_name ORDER BY key_part1 DESC,key_part2 DESC,...
@end example
@node LEFT JOIN optimization, LIMIT optimization, Where optimizations, Query Speed
@subsection How MySQL optimizes @code{LEFT JOIN}
@subsection How MySQL optimizes @code{LEFT JOIN} and @code{RIGHT JOIN}
@code{A LEFT JOIN B} is in @strong{MySQL} implemented as follows:
@@ -25663,9 +25700,12 @@ table and you have the following test: @code{column_name IS NULL} in the
matches the @code{LEFT JOIN} condition.
@end itemize
The table read order forced by @code{LEFT JOIN} and @code{STRAIGHT JOIN} will help
the join optimizer (which calculates in which order tables should be joined) to do
its work much more quickly as there are fewer table permutations to check.
@code{RIGHT JOIN} is implemented analogously as @code{LEFT JOIN}.
The table read order forced by @code{LEFT JOIN} and @code{STRAIGHT JOIN}
will help the join optimizer (which calculates in which order tables
should be joined) to do its work much more quickly as there are fewer
table permutations to check.
Note that the above means that if you do a query of type:
@@ -25673,8 +25713,8 @@ Note that the above means that if you do a query of type:
SELECT * FROM a,b LEFT JOIN c ON (c.key=a.key) LEFT JOIN d (d.key=a.key) WHERE b.key=d.key
@end example
Then @strong{MySQL} will do a full scan on @code{b} as the @code{LEFT JOIN} will
force it to be read before @code{d}.
Then @strong{MySQL} will do a full scan on @code{b} as the @code{LEFT
JOIN} will force it to be read before @code{d}.
The fix in this case is to change the query to:
@@ -30141,11 +30181,17 @@ clients connected to the @code{mysqld} server.
If you need more connections than the default (100), then you should restart
@code{mysqld} with a bigger value for the @code{max_connections} variable.
Note that @code{mysqld} actually allows (@code{max_connections}+1) clients to connect.
The last connection is reserved for a user with the @strong{process} privilege.
By not giving this privilege to normal users (they shouldn't need this), an
administrator with this privilege can login and use @code{SHOW PROCESSLIST}
to find out what could be wrong. @xref{SHOW}.
Note that @code{mysqld} actually allows (@code{max_connections}+1)
clients to connect.  The last connection is reserved for a user with the
@strong{process} privilege.  By not giving this privilege to normal
users (they shouldn't need this), an administrator with this privilege
can login and use @code{SHOW PROCESSLIST} to find out what could be
wrong. @xref{SHOW}.
The maximum number of connects @strong{MySQL} is depending on how good
the thread library is on a given platform. Linux or Solaris should be
able to support 500-1000 simultaneous connections, depending on how much
RAM you have and what your clients are doing.
@node Out of memory, Packet too large, Too many connections, Common errors
@subsection @code{Out of memory} error
@@ -30580,6 +30626,10 @@ shell> export UMASK_DIR
shell> /path/to/safe_mysqld &
@end example
In @strong{MySQL} 3.23.25 and above, @strong{MySQL} assumes that the
value for @code{UMASK} and @code{UMASK_DIR} is in octal if it starts
with a zero.
@xref{Environment variables}.
@node Not enough file handles, Using DATE, File permissions , Problems
@@ -36807,6 +36857,20 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.25
@itemize @bullet
@item
Fixed that databasename works as second argument to @code{mysqlhotcopy}.
@item
@code{UMASK} and @code{UMASK_DIR} can now be specified in octal.
@item
Added @code{RIGHT JOIN}. This makes @code{RIGHT} a reserved word.
@item
Added @code{@@@@IDENTITY} as a synonym for @code{LAST_INSERT_ID()}.
(for Visual Basic)
@item
Fixed bug in myisamchk and @code{REPAIR} when using @code{FULLTEXT} index.
@item
@code{LOAD DATA INFILE} now works for FIFO's.
(Patch by Toni L. Harbaugh-Blackford).
@item
@code{FLUSH LOGS} broke replication if one had @code{log-bin} with 
a log with explicit extension 
@item
@@ -41604,6 +41668,10 @@ If @code{mysqld} hangs you can try to use some system tools like
@code{strace} or @code{/usr/proc/bin/pstack} to examine where
@code{mysqld} has hung.
@example
strace /tmp/log libexec/mysqld
@end example
If @code{mysqld} starts to eat up CPU or memory or if it ``hangs'', you
can use @code{mysqladmin processlist status} to find out if someone is
executing a query that takes a long time.  It may be a good idea to
+7 −6
Original line number Diff line number Diff line
@@ -1409,19 +1409,20 @@ print_table_data_html(MYSQL_RES *result)
  MYSQL_FIELD *field;

  mysql_field_seek(result,0);
  printf("<TABLE BORDER=1>\n");
  printf("<TR>\n");
  fputs("<TABLE BORDER=1><TR>",stdout);
  if (!skip_column_names)
  {
    while((field = mysql_fetch_field(result)))
    {
      printf("<TH>%s</TH>",field->name ? (field->name[0] ? field->name:" &nbsp; "):"NULL");
      printf("<TH>%s</TH>", (field->name ? (field->name[0] ? field->name : 
					    " &nbsp; ") :
			     "NULL"));
    }
    puts("\n</TR>");
    puts("</TR>");
  }
  while ((cur = mysql_fetch_row(result)))
  {
    puts("<TR>");
    fputs("<TR>",stdout);
    for (uint i=0; i < mysql_num_fields(result); i++)
    {
      ulong *lengths=mysql_fetch_lengths(result);
@@ -1429,7 +1430,7 @@ print_table_data_html(MYSQL_RES *result)
      safe_put_field(cur[i],lengths[i]);
      fputs("</TD>",stdout);
    }
    puts("\n</TR>");
    puts("</TR>");
  }
  puts("</TABLE>");
}
+2 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@

/* Return error-text for system error messages and nisam messages */

#define PERROR_VERSION "2.3"
#define PERROR_VERSION "2.4"

#include <global.h>
#include <my_sys.h>
@@ -64,6 +64,7 @@ static HA_ERRORS ha_errlist[]=
  { 141,"Duplicate unique on write or update"},
  { 142,"Unknown character set used"},
  { 143,"Conflicting table definition between MERGE and mapped table"},
  { 144,"Table is crashed and last repair failed"},
  { 0,NullS },
};

+5 −3
Original line number Diff line number Diff line
@@ -43,8 +43,9 @@
#define HA_OPEN_ABORT_IF_LOCKED		0	/* default */
#define HA_OPEN_WAIT_IF_LOCKED		1
#define HA_OPEN_IGNORE_IF_LOCKED	2
#define HA_OPEN_TMP_TABLE		4
#define HA_OPEN_DELAY_KEY_WRITE		8
#define HA_OPEN_TMP_TABLE		4	/* Table is a temp table */
#define HA_OPEN_DELAY_KEY_WRITE		8	/* Don't update index  */
#define HA_OPEN_ABORT_IF_CRASHED	16

	/* The following is parameter to ha_rkey() how to use key */

@@ -163,7 +164,7 @@ enum ha_base_keytype {
#define HA_OPTION_TEMP_COMPRESS_RECORD	((uint) 16384)	/* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA	((uint) 32768)	/* Set by isamchk */

	/* Bits in flag to ni_create() */
	/* Bits in flag to create() */

#define HA_DONT_TOUCH_DATA	1	/* Don't empty datafile (isamchk) */
#define HA_PACK_RECORD		2	/* Request packed record format */
@@ -203,6 +204,7 @@ enum ha_base_keytype {
#define HA_ERR_FOUND_DUPP_UNIQUE 141	/* Dupplicate unique on write */
#define HA_ERR_UNKNOWN_CHARSET	 142	/* Can't open charset */
#define HA_ERR_WRONG_TABLE_DEF	 143
#define HA_ERR_CRASHED_ON_REPAIR 144	/* Last (automatic?) repair failed */

	/* Other constants */

+2 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ extern int NEAR my_errno; /* Last error in mysys */
#define MY_LINK_WARNING 32	/* my_redel() gives warning if links */
#define MY_COPYTIME	64	/* my_redel() copys time */
#define MY_HOLD_ORIGINAL_MODES 128  /* my_copy() holds to file modes */
#define MY_REDEL_MAKE_BACKUP 256
#define MY_SEEK_NOT_DONE 32	/* my_lock may have to do a seek */
#define MY_DONT_WAIT	64	/* my_lock() don't wait if can't lock */
#define MY_ZEROFILL	32	/* my_malloc(), fill array with zero */
@@ -219,7 +220,7 @@ typedef struct st_typelib { /* Different types saved here */
  const char **type_names;
} TYPELIB;

enum cache_type {READ_CACHE,WRITE_CACHE,READ_NET,WRITE_NET};
enum cache_type {READ_CACHE,WRITE_CACHE,READ_FIFO,READ_NET,WRITE_NET};
enum flush_type { FLUSH_KEEP, FLUSH_RELEASE, FLUSH_IGNORE_CHANGED,
		  FLUSH_FORCE_WRITE};

Loading