Commit eb1bbe1c authored by unknown's avatar unknown

Added --skip-safemalloc to mysqltest

Added bug fix from 3.23 for AIX 4.3.3 and gcc 3.x
Small change in EXCHANGE output
Propagate open-files-limit from mysqld_safe -> mysqld
Fixed speed bug in GROUP BY
Added quotes around database name in CREATE DATABASE db_name (for binary log)


BitKeeper/etc/ignore:
  added stamp-h1
Docs/manual.texi:
  Added 4.1 manual section
  Updated changelog
client/mysqltest.c:
  Added --skip-safemalloc
include/my_global.h:
  Added bug fix from 3.23 for AIX 4.3.3 and gcc 3.x
mysql-test/mysql-test-run.sh:
  Start mysqltest with --skip-safemalloc (To get it faster)
mysql-test/r/bdb.result:
  Update for new EXPLAIN output
mysql-test/r/compare.result:
  Update for new EXPLAIN output
mysql-test/r/create.result:
  Update for new EXPLAIN output
mysql-test/r/distinct.result:
  Update for new EXPLAIN output
mysql-test/r/explain.result:
  Update for new EXPLAIN output
mysql-test/r/group_by.result:
  Update for new EXPLAIN output
mysql-test/r/heap.result:
  Update for new EXPLAIN output
mysql-test/r/innodb.result:
  Update for new EXPLAIN output
mysql-test/r/join_outer.result:
  Update for new EXPLAIN output
mysql-test/r/key_diff.result:
  Update for new EXPLAIN output
mysql-test/r/merge.result:
  Update for new EXPLAIN output
mysql-test/r/null_key.result:
  Update for new EXPLAIN output
mysql-test/r/order_by.result:
  Update for new EXPLAIN output
mysql-test/r/select.result:
  Update for new EXPLAIN output
mysql-test/r/temp_table.result:
  Fixed speed bug in GROUP BY
mysql-test/r/type_datetime.result:
  Update for new EXPLAIN output
mysql-test/r/user_var.result:
  Update for new EXPLAIN output
mysql-test/r/variables.result:
  Removed variable safe_show_database
mysql-test/t/temp_table.test:
  Fixed speed bug in GROUP BY
mysql-test/t/variables.test:
  Removed not used variable safe_show_databases
scripts/mysqld_safe.sh:
  Propagate open-files-limit from mysqld_safe -> mysqld
sql/mysqld.cc:
  Removed variable safe_show_database
sql/set_var.cc:
  Removed variable safe_show_database
sql/slave.cc:
  Updated error message
sql/sql_db.cc:
  Added quotes around database name in CREATE DATABASE db_name
sql/sql_select.cc:
  Fixed speed bug in GROUP BY
parent 378cb19a
......@@ -494,3 +494,5 @@ vio/test-ssl
vio/test-sslclient
vio/test-sslserver
vio/viotest-ssl
innobase/stamp-h1
stamp-h1
......@@ -8202,6 +8202,10 @@ The following startup variables/options have been renamed:
The startup options @code{record_buffer}, @code{sort_buffer} and
@code{warnings} will still work in MySQL 4.0 but are deprecated.
@item
The mysqld option @code{--safe_show_database} doesn't work anymore. One
should instead give the @code{SHOW DATABASES} privileges to everyone that
need to see all databases.
@item
The following SQL variables have changed name.
@c arjen note: New table, not yet measured for O'Reilly/DocBook.
@multitable @columnfractions .50 .50
......@@ -19879,7 +19883,6 @@ differ somewhat:
| query_cache_limit | 1048576 |
| query_cache_size | 0 |
| query_cache_type | ON |
| safe_show_database | OFF |
| server_id | 0 |
| slave_net_timeout | 3600 |
| skip_external_locking | ON |
......@@ -20314,7 +20317,8 @@ This may be set (only numeric) to
Don't show databases for which the user doesn't have any database or
table privileges. This can improve security if you're concerned about
people being able to see what databases other users have. See also
@code{skip_show_database}.
@code{skip_show_database}. This option is deprecated as one should instead
use the @code{SHOW DATABASES} privilege instead.
@item @code{server_id}
The value of the @code{--server-id} option.
......@@ -20327,7 +20331,7 @@ Is ON if we only allow local (socket) connections.
@item @code{skip_show_database}
This prevents people from doing @code{SHOW DATABASES} if they don't have
the @code{PROCESS} privilege. This can improve security if you're
the @code{SHOW DATABASE} privilege. This can improve security if you're
concerned about people being able to see what databases other users
have. See also @code{safe_show_database}.
......@@ -23683,7 +23687,7 @@ started}, your slaves may fail.
Please see the following table for an indication of master-slave
compatibility between different versions. With regard to version 4.0,
we recommend using same version on both sides.
we recommend using at least 4.0.4 on both sides.
@c FIX arjen 2002-07-17 new table, not yet measured for XML/DocBook.
@multitable @columnfractions .10 .15 .15 .10 .10 .10
......@@ -24350,7 +24354,7 @@ may be used with @code{IO_THREAD} and @code{SQL_THREAD} options. (Slave)
@tab Re-enables update logging if the user has the @code{SUPER} privilege.
Ignored otherwise. (Master)
@item @code{GLOBAL SET SQL_SLAVE_SKIP_COUNTER=n}
@item @code{SET GLOBAL SQL_SLAVE_SKIP_COUNTER=n}
@tab Skip the next @code{n} events from the master. Only valid when
the slave thread is not running, otherwise, gives an error. Useful for
recovering from replication glitches.
......@@ -25510,7 +25514,7 @@ temporary table to hold the result. This typically happens if you do an
@code{ORDER BY} on a different column set than you did a @code{GROUP
BY} on.
@item Where used
@item Using where (was @code{where used})
A @code{WHERE} clause will be used to restrict which rows will be
matched against the next table or sent to the client. If you don't have
this information and the table is of type @code{ALL} or @code{index},
......@@ -25670,7 +25674,7 @@ Executing the @code{EXPLAIN} statement again produces this result:
@example
table type possible_keys key key_len ref rows Extra
tt ALL AssignedPC,ClientID,ActualPC NULL NULL NULL 3872 where used
tt ALL AssignedPC,ClientID,ActualPC NULL NULL NULL 3872 Using where
do ALL PRIMARY NULL NULL NULL 2135
range checked for each record (key map: 1)
et_1 ALL PRIMARY NULL NULL NULL 74
......@@ -25696,7 +25700,7 @@ Now @code{EXPLAIN} produces the output shown here:
@example
table type possible_keys key key_len ref rows Extra
et ALL PRIMARY NULL NULL NULL 74
tt ref AssignedPC, ActualPC 15 et.EMPLOYID 52 where used
tt ref AssignedPC, ActualPC 15 et.EMPLOYID 52 Using where
ClientID,
ActualPC
et_1 eq_ref PRIMARY PRIMARY 15 tt.AssignedPC 1
......@@ -25719,7 +25723,7 @@ Now the join is perfect, and @code{EXPLAIN} produces this result:
@example
table type possible_keys key key_len ref rows Extra
tt ALL AssignedPC NULL NULL NULL 3872 where used
tt ALL AssignedPC NULL NULL NULL 3872 Using where
ClientID,
ActualPC
et eq_ref PRIMARY PRIMARY 15 tt.ActualPC 1
......@@ -28868,7 +28872,6 @@ and if you can use @code{GLOBAL} or @code{SESSION} with them.
@item read_buffer_size @tab num @tab GLOBAL | SESSION
@item read_rnd_buffer_size @tab num @tab GLOBAL | SESSION
@item rpl_recovery_rank @tab num @tab GLOBAL
@item safe_show_database @tab bool @tab GLOBAL
@item server_id @tab num @tab GLOBAL
@item slave_compressed_protocol @tab bool @tab GLOBAL
@item slave_net_timeout @tab num @tab GLOBAL
......@@ -38698,8 +38701,8 @@ SUM_OVER_ALL_KEYS(max_length_of_key + sizeof(char*) * 2)
* Table and index:: Table and Index Structures
* File space management:: File Space Management and Disk I/O
* Error handling:: Error Handling
* InnoDB change history:: InnoDB Change History
* InnoDB restrictions:: Restrictions on InnoDB Tables
* InnoDB change history:: InnoDB Change History
* InnoDB contact information:: InnoDB Contact Information.
@end menu
......@@ -50735,6 +50738,7 @@ this means that the version has not yet been released!
@c Please don't add a new version here without also updating ../configure.in!
@menu
* News-4.1.x::
* News-4.0.x:: Changes in release 4.0.x (Beta)
* News-3.23.x:: Changes in release 3.23.x (Stable)
* News-3.22.x:: Changes in release 3.22.x (Older; Still supported)
......@@ -50744,7 +50748,77 @@ this means that the version has not yet been released!
@end menu
@node News-4.0.x, News-3.23.x, News, News
@node News-4.1.x, News-4.0.x, News, News
@appendixsec Changes in release 4.1.x (Alpha)
@cindex changes, version 4.1
Version 4.1 of the MySQL server includes many enhancements and new features:
@itemize @bullet
@item
Sub selects: @code{SELECT * from t1 where t1.a=(SELECT t2.b FROM t2)}.
@item
Character sets to be defined per column, table and database.
@item
Unicode (UTF8) support.
@item
Derived tables: @code{SELECT a from t1, (select * from t2) WHERE t1.a=t2.a}
@item
@code{BTREE} index on @code{HEAP} tables.
@item
Support for GIS (Geometrical data).
@item
@code{SHOW WARNINGS}; Shows warnings for the last command.
@end itemize
For a full list of changes, please refer to the changelog sections for
each individual 4.1.x release.
@menu
* News-4.1.0::
@end menu
@node News-4.1.0, , News-4.1.x, News-4.1.x
@appendixsubsec Changes in release 4.1.0
@itemize
@item
One can specify many temporary directories to be used in a round-robin
fasion with: @code{--tmpdir=dirname1:dirname2:dirname3}.
@item
Sub selects: @code{SELECT * from t1 where t1.a=(SELECT t2.b FROM t2)}.
@item
Character sets to be defined per column, table and database.
@item
Unicode (UTF8) support.
@item
Derived tables: @code{SELECT a from t1, (select * from t2) WHERE t1.a=t2.a}
@item
@code{BTREE} index on @code{HEAP} tables.
@item
Faster embedded server.
@item
One can add a comment per column in @code{CREATE TABLE}.
@item
@code{SHOW FULL COLUMNS FROM table_name} shows column comments.
@item
@code{ALTER DATABASE}.
@item
Support for GIS (Geometrical data).
@item
@code{SHOW WARNINGS}; Shows warnings from the last command.
@item
One can specify a column type for a colum in @code{CREATE TABLE
... SELECT} by defining the column in the @code{CREATE} part
@example
CREATE TABLE foo (a tinyint not null) SELECT b+1 AS 'a' FROM bar;
@end example
@end itemize
@node News-4.0.x, News-3.23.x, News-4.1.x, News
@appendixsec Changes in release 4.0.x (Beta)
@cindex changes, version 4.0
......@@ -50815,6 +50889,17 @@ each individual 4.0.x release.
@appendixsubsec Changes in release 4.0.5
@itemize
@item
When one uses the @code{--open-files-limit=#} option to @code{mysqld_safe}
it's now passed on to @code{mysqld}
@item
Fixed that @code{GROUP BY} on columns that may have a @code{NULL} value
doesn't always use disk based temporary tables.
@item
Changed output from @code{EXPLAIN} from @code{'where used'} to
@code{'Using where'} to make it more in line with other output.
@item
Removed variable @code{safe_show_database} as it was not used anymore.
@item
Small code improvement in multi-table updates
@item
Fixed a newly introduced bug that caused @code{ORDER BY ... LIMIT #}
......@@ -51680,6 +51765,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.54
@itemize
@item
Allow one to start multiple MySQL servers on windows (code backported
from 4.0.2).
@item
Fixed reference to freed memory when doing complicated @code{GROUP BY
... ORDER BY} queries. Symptom was that @code{mysqld} died in function
@code{send_fields}.
......@@ -52504,8 +52592,9 @@ long as @code{server-id} is set and valid @file{master.info} is present.
Partial updates (terminated with kill) are now logged with a special error
code to the binary log. Slave will refuse to execute them if the error code
indicates the update was terminated abnormally, and will have to be recovered
with @code{SET SQL_SLAVE_SKIP_COUNTER=1; SLAVE START} after a manual sanity
check/correction of data integrity.
with @code{SET SQL_SLAVE_SKIP_COUNTER=1; SLAVE START} after a manual
sanity check/correction of data integrity. Update: In 4.0.3 and above
you have to use @code{SET GLOBAL}.
@item
Fixed bug that erroneously logged a drop of internal temporary table
on thread termination to the binary log -- this bug affected replication.
......@@ -91,7 +91,7 @@
enum {OPT_MANAGER_USER=256,OPT_MANAGER_HOST,OPT_MANAGER_PASSWD,
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT};
OPT_MANAGER_PORT,OPT_MANAGER_WAIT_TIMEOUT, OPT_SKIP_SAFEMALLOC};
static int record = 0, opt_sleep=0;
static char *db = 0, *pass=0;
......@@ -1845,6 +1845,9 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Suppress all normal output. Synonym for --quiet.",
(gptr*) &silent, (gptr*) &silent, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
"Don't use the memory allocation checking", 0, 0, 0, GET_NO_ARG, NO_ARG,
0, 0, 0, 0, 0, 0},
{"sleep", 'T', "Sleep always this many seconds on sleep commands",
(gptr*) &opt_sleep, (gptr*) &opt_sleep, 0, GET_INT, REQUIRED_ARG, 0, 0, 0,
0, 0, 0},
......@@ -1944,6 +1947,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
if (read_server_arguments(argument))
die(NullS);
break;
case OPT_SKIP_SAFEMALLOC:
#ifdef SAFEMALLOC
sf_malloc_quick=1;
#endif
break;
case 'V':
print_version();
exit(0);
......@@ -2301,6 +2309,7 @@ static void var_from_env(const char* name, const char* def_val)
static void init_var_hash()
{
VAR* v;
DBUG_ENTER("init_var_hash");
if (hash_init(&var_hash, 1024, 0, 0, get_var_key, var_free, MYF(0)))
die("Variable hash initialization failed");
var_from_env("MASTER_MYPORT", "9306");
......@@ -2309,6 +2318,7 @@ static void init_var_hash()
var_from_env("BIG_TEST", opt_big_test ? "1" : "0");
v=var_init(0,"MAX_TABLES", 0, (sizeof(ulong) == 4) ? "31" : "63",0);
hash_insert(&var_hash, (byte*)v);
DBUG_VOID_RETURN;
}
......
......@@ -119,7 +119,16 @@
#define _H_STRINGS
#define _SYS_STREAM_H
/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
#ifdef __cplusplus
extern "C" {
#endif
double my_ulonglong2double(unsigned long long A);
#ifdef __cplusplus
}
#endif
#endif /* _AIX */
#ifdef HAVE_BROKEN_SNPRINTF /* HPUX 10.20 don't have this defined */
#undef HAVE_SNPRINTF
......
......@@ -369,6 +369,7 @@ fi
[ -d $MYSQL_TEST_DIR/var ] || mkdir $MYSQL_TEST_DIR/var
[ -d $MYSQL_TEST_DIR/var/tmp ] || mkdir $MYSQL_TEST_DIR/var/tmp
[ -d $MYSQL_TEST_DIR/var/run ] || mkdir $MYSQL_TEST_DIR/var/run
[ -d $MYSQL_TEST_DIR/var/log ] || mkdir $MYSQL_TEST_DIR/var/log
if test ${COLUMNS:-0} -lt 80 ; then COLUMNS=80 ; fi
E=`$EXPR $COLUMNS - 8`
......@@ -454,7 +455,7 @@ fi
MYSQL_TEST_ARGS="--no-defaults --socket=$MASTER_MYSOCK --database=$DB \
--user=$DBUSER --password=$DBPASSWD --silent -v \
--user=$DBUSER --password=$DBPASSWD --silent -v --skip-safemalloc \
--tmpdir=$MYSQL_TMP_DIR"
MYSQL_TEST_BIN=$MYSQL_TEST
MYSQL_TEST="$MYSQL_TEST $MYSQL_TEST_ARGS"
......
......@@ -140,13 +140,13 @@ id parent_id level
1010 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used; Using index
t1 ref level level 1 const 1 Using where; Using index
explain select level,id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used; Using index
t1 ref level level 1 const 1 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used
t1 ref level level 1 const 1 Using where
select level,id from t1 where level=1;
level id
1 1002
......@@ -625,7 +625,7 @@ id parent_id level
1016 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 1 where used; Using index
t1 ref level level 1 const 1 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
......
......@@ -3,7 +3,7 @@ CREATE TABLE t1 (id CHAR(12) not null, PRIMARY KEY (id));
insert into t1 values ('000000000001'),('000000000002');
explain select * from t1 where id=000000000001;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 12 NULL 2 where used; Using index
t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
select * from t1 where id=000000000001;
id
000000000001
......
......@@ -63,7 +63,7 @@ insert into t1 (b) values ("hello"),("my"),("world");
create table t2 (key (b)) select * from t1;
explain select * from t2 where b="world";
table type possible_keys key key_len ref rows Extra
t2 ref B B 21 const 1 where used
t2 ref B B 21 const 1 Using where
select * from t2 where b="world";
a B
3 world
......
......@@ -175,7 +175,7 @@ explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
table type possible_keys key key_len ref rows Extra
t3 index a a 5 NULL 6 Using index; Using temporary
t2 index a a 4 NULL 5 Using index; Distinct
t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 where used; Distinct
t1 eq_ref PRIMARY PRIMARY 4 t2.a 1 Using where; Distinct
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
......@@ -190,7 +190,7 @@ insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 2 Using index; Using temporary
t3 ref a a 5 t1.a 10 where used; Using index; Distinct
t3 ref a a 5 t1.a 10 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
......@@ -278,10 +278,10 @@ table type possible_keys key key_len ref rows Extra
t1 index id id 4 NULL 2 Using index; Using temporary
t2 index id id 8 NULL 1 Using index; Distinct
t3 index id id 8 NULL 1 Using index; Distinct
j_lj_t2 index id id 4 NULL 2 where used; Using index; Distinct
t2_lj index id id 8 NULL 1 where used; Using index; Distinct
j_lj_t3 index id id 4 NULL 2 where used; Using index; Distinct
t3_lj index id id 8 NULL 1 where used; Using index; Distinct
j_lj_t2 index id id 4 NULL 2 Using where; Using index; Distinct
t2_lj index id id 8 NULL 1 Using where; Using index; Distinct
j_lj_t3 index id id 4 NULL 2 Using where; Using index; Distinct
t3_lj index id id 8 NULL 1 Using where; Using index; Distinct
SELECT DISTINCT
t1.id
from
......
......@@ -10,13 +10,13 @@ id str
3 foo
explain select * from t1 where str is null;
table type possible_keys key key_len ref rows Extra
t1 ref str str 11 const 1 where used
t1 ref str str 11 const 1 Using where
explain select * from t1 where str="foo";
table type possible_keys key key_len ref rows Extra
t1 const str str 11 const 1
explain select * from t1 ignore key (str) where str="foo";
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4 where used
t1 ALL NULL NULL NULL NULL 4 Using where
explain select * from t1 use key (str,str) where str="foo";
table type possible_keys key key_len ref rows Extra
t1 const str str 11 const 1
......
......@@ -234,10 +234,10 @@ userid count(*)
1 2
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
table type possible_keys key key_len ref rows Extra
t1 range spID spID 5 NULL 2 where used; Using index
t1 range spID spID 5 NULL 2 Using where; Using index
explain select spid,count(*) from t1 where spid between 1 and 2 group by spid;
table type possible_keys key key_len ref rows Extra
t1 range spID spID 5 NULL 2 where used; Using index
t1 range spID spID 5 NULL 2 Using where; Using index
select spid,count(*) from t1 where spid between 1 and 2 group by spid;
spid count(*)
1 1
......
......@@ -66,7 +66,7 @@ a
alter table t1 type=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
table type possible_keys key key_len ref rows Extra
t1 range uniq_id uniq_id 4 NULL 4 where used; Using index
t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index
drop table t1;
create table t1 (x int not null, y int not null, key x(x), unique y(y))
type=heap;
......@@ -159,17 +159,17 @@ create table t1 (btn char(10) not null, key(btn)) type=heap;
insert into t1 values ("hello"),("hello"),("hello"),("hello"),("hello"),("a"),("b"),("c"),("d"),("e"),("f"),("g"),("h"),("i");
explain select * from t1 where btn like "q%";
table type possible_keys key key_len ref rows Extra
t1 ALL btn NULL NULL NULL 14 where used
t1 ALL btn NULL NULL NULL 14 Using where
select * from t1 where btn like "q%";
btn
alter table t1 add column new_col char(1) not null, add key (btn,new_col), drop key btn;
update t1 set new_col=btn;
explain select * from t1 where btn="a";
table type possible_keys key key_len ref rows Extra
t1 ALL btn NULL NULL NULL 14 where used
t1 ALL btn NULL NULL NULL 14 Using where
explain select * from t1 where btn="a" and new_col="a";
table type possible_keys key key_len ref rows Extra
t1 ref btn btn 11 const,const 10 where used
t1 ref btn btn 11 const,const 10 Using where
drop table t1;
CREATE TABLE t1 (
a int default NULL,
......@@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
a b
explain SELECT * FROM t1 WHERE a IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ref a a 5 const 10 where used
t1 ref a a 5 const 10 Using where
SELECT * FROM t1 WHERE a<=>NULL;
a b
NULL 99
......@@ -190,7 +190,7 @@ SELECT * FROM t1 WHERE b=NULL;
a b
explain SELECT * FROM t1 WHERE b IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ref b b 5 const 1 where used
t1 ref b b 5 const 1 Using where
SELECT * FROM t1 WHERE b<=>NULL;
a b
99 NULL
......
......@@ -140,13 +140,13 @@ id parent_id level
1015 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 12 where used; Using index
t1 ref level level 1 const 12 Using where; Using index
explain select level,id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 12 where used; Using index
t1 ref level level 1 const 12 Using where; Using index
explain select level,id,parent_id from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 12 where used
t1 ref level level 1 const 12 Using where
select level,id from t1 where level=1;
level id
1 1002
......@@ -597,7 +597,7 @@ id parent_id level
1016 102 2
explain select level from t1 where level=1;
table type possible_keys key key_len ref rows Extra
t1 ref level level 1 const 6 where used; Using index
t1 ref level level 1 const 6 Using where; Using index
select level,id from t1 where level=1;
level id
1 1004
......@@ -759,7 +759,7 @@ create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h
insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
explain select * from t1 where a > 0 and a < 50;
table type possible_keys key key_len ref rows Extra
t1 range PRIMARY PRIMARY 4 NULL 1 where used
t1 range PRIMARY PRIMARY 4 NULL 1 Using where
drop table t1;
create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) type=innodb;
insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
......
......@@ -95,7 +95,7 @@ Impossible WHERE noticed after reading const tables
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 7
t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 where used
t2 eq_ref PRIMARY PRIMARY 8 t1.a 1 Using where
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
grp a c id a c d a
1 1 a 1 1 a 1 1
......@@ -313,11 +313,11 @@ Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.id is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used; Not exists
t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t1 left join t2 on (t1.id = t2.owner) where t2.name is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used
t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t1 left join t2 on (t1.id = t2.owner);
count(*)
4
......@@ -333,11 +333,11 @@ Lilliana Angelovska NULL NULL
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.id is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used; Not exists
t2 ALL NULL NULL NULL NULL 3 Using where; Not exists
explain select t1.name, t2.name, t2.id from t2 right join t1 on (t1.id = t2.owner) where t2.name is null;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3
t2 ALL NULL NULL NULL NULL 3 where used
t2 ALL NULL NULL NULL NULL 3 Using where
select count(*) from t2 right join t1 on (t1.id = t2.owner);
count(*)
4
......@@ -620,7 +620,7 @@ INSERT INTO t2 VALUES (1,1);
explain SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 2
t2 index id id 8 NULL 1 where used; Using index; Not exists
t2 index id id 8 NULL 1 Using where; Using index; Not exists
SELECT * from t1 left join t2 on t1.id=t2.id where t2.id IS NULL;
id name id idx
2 no NULL NULL
......@@ -640,7 +640,7 @@ insert into t2 values (10,1),(20,2),(30,3);
explain select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
table type possible_keys key key_len ref rows Extra
t2 index NULL PRIMARY 4 NULL 3 Using index
t1 eq_ref PRIMARY PRIMARY 2 const 1 where used; Using index
t1 eq_ref PRIMARY PRIMARY 2 const 1 Using where; Using index
select * from t2 left join t1 on t1.fooID = t2.fooID and t1.fooID = 30;
fooID barID fooID
10 1 NULL
......
......@@ -36,7 +36,7 @@ a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
table type possible_keys key key_len ref rows Extra
t1 ALL a NULL NULL NULL 5
t2 ALL b NULL NULL NULL 5 where used
t2 ALL b NULL NULL NULL 5 Using where
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
......
......@@ -35,10 +35,10 @@ insert into t1 select NULL,message from t2;
create table t3 (a int not null, b char(20), key(a)) type=MERGE UNION=(test.t1,test.t2);
explain select * from t3 where a < 10;
table type possible_keys key key_len ref rows Extra
t3 range a a 4 NULL 10 where used
t3 range a a 4 NULL 10 Using where
explain select * from t3 where a > 10 and a < 20;
table type possible_keys key key_len ref rows Extra
t3 range a a 4 NULL 10 where used
t3 range a a 4 NULL 10 Using where
select * from t3 where a = 10;
a b
10 Testing
......
......@@ -3,37 +3,37 @@ create table t1 (a int, b int not null,unique key (a,b),index(b)) type=myisam;
insert ignore into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(null,7),(9,9),(8,8),(7,7),(null,9),(null,9),(6,6);
explain select * from t1 where a is null;
table type possible_keys key key_len ref rows Extra
t1 ref a a 5 const 3 where used; Using index
t1 ref a a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b = 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 9 const,const 1 where used; Using index
t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a is null and b = 7;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 9 const,const 1 where used; Using index
t1 ref a,b a 9 const,const 1 Using where; Using index
explain select * from t1 where a=2 and b = 2;
table type possible_keys key key_len ref rows Extra
t1 const a,b a 9 const,const 1
explain select * from t1 where a<=>b limit 2;
table type possible_keys key key_len ref rows Extra
t1 index NULL a 9 NULL 12 where used; Using index
t1 index NULL a 9 NULL 12 Using where; Using index
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 limit 3;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 9 NULL 3 where used; Using index
t1 range a,b a 9 NULL 3 Using where; Using index
explain select * from t1 where (a is null or a = 7) and b=7;
table type possible_keys key key_len ref rows Extra
t1 ref a,b b 4 const 2 where used
t1 ref a,b b 4 const 2 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used; Using index
t1 ref a,b a 5 const 3 Using where; Using index
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 9 NULL 2 where used; Using index
t1 range a,b a 9 NULL 2 Using where; Using index
explain select * from t1 where a > 1 and a < 3 limit 1;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used; Using index
t1 range a a 5 NULL 1 Using where; Using index
explain select * from t1 where a > 8 and a < 9;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used; Using index
t1 range a a 5 NULL 1 Using where; Using index
select * from t1 where a is null;
a b
NULL 7
......@@ -66,43 +66,43 @@ NULL 9
alter table t1 modify b blob not null, add c int not null, drop key a, add unique key (a,b(20),c), drop key b, add key (b(10));
explain select * from t1 where a is null and b = 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 2 and c=0;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b = 7 and c=0;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a=2 and b = 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 1 where used
t1 ref a,b a 5 const 1 Using where
explain select * from t1 where a<=>b limit 2;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 12 where used
t1 ALL NULL NULL NULL NULL 12 Using where
explain select * from t1 where (a is null or a > 0 and a < 3) and b < 5 and c=0 limit 3;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 5 NULL 5 where used
t1 range a,b a 5 NULL 5 Using where
explain select * from t1 where (a is null or a = 7) and b=7 and c=0;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 5 NULL 4 where used
t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where (a is null and b>a) or a is null and b=7 limit 2;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a is null and b=9 or a is null and b=7 limit 3;
table type possible_keys key key_len ref rows Extra
t1 ref a,b a 5 const 3 where used
t1 ref a,b a 5 const 3 Using where
explain select * from t1 where a > 1 and a < 3 limit 1;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used
t1 range a a 5 NULL 1 Using where
explain select * from t1 where a is null and b=7 or a > 1 and a < 3 limit 1;
table type possible_keys key key_len ref rows Extra
t1 range a,b a 5 NULL 4 where used
t1 range a,b a 5 NULL 4 Using where
explain select * from t1 where a > 8 and a < 9;
table type possible_keys key key_len ref rows Extra
t1 range a a 5 NULL 1 where used
t1 range a a 5 NULL 1 Using where
explain select * from t1 where b like "6%";
table type possible_keys key key_len ref rows Extra
t1 range b b 12 NULL 1 where used
t1 range b b 12 NULL 1 Using where
select * from t1 where a is null;
a b c
NULL 7 0
......@@ -152,7 +152,7 @@ INSERT INTO t1 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4
INSERT INTO t2 VALUES (1,NULL),(2,NULL),(3,1),(4,2),(5,NULL),(6,NULL),(7,3),(8,4),(9,NULL),(10,NULL);
explain select id from t1 where uniq_id is null;
table type possible_keys key key_len ref rows Extra
t1 ref idx1 idx1 5 const 1 where used
t1 ref idx1 idx1 5 const 1 Using where
explain select id from t1 where uniq_id =1;
table type possible_keys key key_len ref rows Extra
t1 const idx1 idx1 5 const 1
......
......@@ -264,13 +264,13 @@ create table t1 (a int not null, b int, c varchar(10), key (a, b, c));
insert into t1 values (1, NULL, NULL), (1, NULL, 'b'), (1, 1, NULL), (1, 1, 'b'), (1, 1, 'b'), (2, 1, 'a'), (2, 1, 'b'), (2, 2, 'a'), (2, 2, 'b'), (2, 3, 'c'),(1,3,'b');
explain select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 20 NULL 2 where used; Using index
t1 range a a 20 NULL 2 Using where; Using index
select * from t1 where (a = 1 and b is null and c = 'b') or (a > 2) order by a desc;
a b c
1 NULL b
explain select * from t1 where a >= 1 and a < 3 order by a desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 4 NULL 10 where used; Using index
t1 range a a 4 NULL 10 Using where; Using index
select * from t1 where a >= 1 and a < 3 order by a desc;
a b c
2 3 c
......@@ -286,7 +286,7 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 ref a a 4 const 5 where used; Using index
t1 ref a a 4 const 5 Using where; Using index
select * from t1 where a = 1 order by a desc, b desc;
a b c
1 3 b
......@@ -297,30 +297,30 @@ a b c
1 NULL NULL
explain select * from t1 where a = 1 and b is null order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 ref a a 9 const,const 2 where used; Using index; Using filesort
t1 ref a a 9 const,const 2 Using where; Using index; Using filesort
select * from t1 where a = 1 and b is null order by a desc, b desc;
a b c
1 NULL NULL
1 NULL b
explain select * from t1 where a >= 1 and a < 3 and b >0 order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 8 where used; Using index; Using filesort
t1 range a a 9 NULL 8 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and b >0 order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 5 where used; Using index
t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b is null order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 ref a a 9 const,const 1 where used; Using index; Using filesort
t1 ref a a 9 const,const 1 Using where; Using index; Using filesort
explain select * from t1 where a = 2 and (b is null or b > 0) order by a
desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 6 where used; Using index
t1 range a a 9 NULL 6 Using where; Using index
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 5 where used; Using index
t1 range a a 9 NULL 5 Using where; Using index
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 9 NULL 2 where used; Using index; Using filesort
t1 range a a 9 NULL 2 Using where; Using index; Using filesort
alter table t1 modify b int not null, modify c varchar(10) not null;
explain select * from t1 order by a, b, c;
table type possible_keys key key_len ref rows Extra
......@@ -356,14 +356,14 @@ a b c
1 0
explain select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 18 NULL 3 where used; Using index
t1 range a a 18 NULL 3 Using where; Using index
select * from t1 where (a = 1 and b = 1 and c = 'b') or (a > 2) order by a desc;
a b c
1 1 b
1 1 b
explain select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 4 NULL 6 where used; Using index
t1 range a a 4 NULL 6 Using where; Using index
select * from t1 where a < 2 and b <= 1 order by a desc, b desc;
a b c
1 1 b
......@@ -387,7 +387,7 @@ a b c
1 1
explain select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 8 NULL 10 where used; Using index
t1 range a a 8 NULL 10 Using where; Using index
select * from t1 where a between 1 and 3 and b <= 1 order by a desc, b desc;
a b c
2 1 b
......@@ -399,7 +399,7 @@ a b c
1 0
explain select * from t1 where a between 0 and 1 order by a desc, b desc;
table type possible_keys key key_len ref rows Extra
t1 range a a 4 NULL 5 where used; Using index
t1 range a a 4 NULL 5 Using where; Using index
select * from t1 where a between 0 and 1 order by a desc, b desc;
a b c
1 3 b
......@@ -452,24 +452,24 @@ EXPLAIN select t1.gid, t2.sid, t3.uid from t3, t2, t1 where t2.gid = t1.gid and
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index
t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t1.gid,t3.skr;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t2.sid, t3.uid from t2, t1, t3 where t2.gid = t1.gid and t2.uid = t3.uid order by t3.uid, t1.gid;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
t2 eq_ref PRIMARY,uid PRIMARY 4 t1.gid 1
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 where used; Using index
t3 eq_ref PRIMARY PRIMARY 2 t2.uid 1 Using where; Using index
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.gid = t3.uid order by t3.skr,t1.gid;
table type possible_keys key key_len ref rows Extra
t1 index PRIMARY PRIMARY 4 NULL 6 Using index; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 where used
t3 eq_ref PRIMARY PRIMARY 2 t1.gid 1 Using where
EXPLAIN SELECT t1.gid, t3.uid from t1, t3 where t1.skr = t3.uid order by t1.gid,t3.skr;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 where used
t3 eq_ref PRIMARY PRIMARY 2 t1.skr 1 Using where
drop table t1,t2,t3;
CREATE TABLE t1 (
`titre` char(80) NOT NULL default '',
......
......@@ -1328,19 +1328,19 @@ select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%';
fld3
explain select t2.fld3 from t2 where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 ref fld3 fld3 30 const 1 where used; Using index
t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 index NULL fld3 30 NULL 1199 where used; Using index
t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 index NULL fld3 30 NULL 1199 where used; Using index
t2 index NULL fld3 30 NULL 1199 Using where; Using index
explain select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 ref fld3 fld3 30 const 1 where used; Using index
t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle';
table type possible_keys key key_len ref rows Extra
t2 ref fld3 fld3 30 const 1 where used; Using index
t2 ref fld3 fld3 30 const 1 Using where; Using index
explain select fld3 from t2 ignore index (fld3,not_used);
Key column 'not_used' doesn't exist in table
explain select fld3 from t2 use index (not_used);
......@@ -1351,7 +1351,7 @@ honeysuckle
honoring
explain select t2.fld3 from t2 where fld3 >= 'honeysuckle' and fld3 <= 'honoring' order by fld3;
table type possible_keys key key_len ref rows Extra
t2 range fld3 fld3 30 NULL 2 where used; Using index
t2 range fld3 fld3 30 NULL 2 Using where; Using index
select fld1,fld3 from t2 where fld3="Colombo" or fld3 = "nondecreasing" order by fld3;
fld1 fld3
148504 Colombo
......@@ -1371,7 +1371,7 @@ fld1
250502
explain select fld1 from t2 where fld1=250501 or fld1="250502";
table type possible_keys key key_len ref rows Extra
t2 range fld1 fld1 4 NULL 2 where used; Using index
t2 range fld1 fld1 4 NULL 2 Using where; Using index
select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
fld1
250501
......@@ -1380,7 +1380,7 @@ fld1
250601
explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 and fld1 <= 250601 or fld1 between 250501 and 250502;
table type possible_keys key key_len ref rows Extra
t2 range fld1 fld1 4 NULL 4 where used; Using index
t2 range fld1 fld1 4 NULL 4 Using where; Using index
select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
fld1 fld3
218401 faithful
......@@ -1807,8 +1807,8 @@ select distinct fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr orde
fld3
explain select t3.t2nr,fld3 from t2,t3 where t2.companynr = 34 and t2.fld1=t3.t2nr order by t3.t2nr,fld3;
table type possible_keys key key_len ref rows Extra
t2 ALL fld1 NULL NULL NULL 1199 where used; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 where used; Using index
t2 ALL fld1 NULL NULL NULL 1199 Using where; Using temporary; Using filesort
t3 eq_ref PRIMARY PRIMARY 4 t2.fld1 1 Using where; Using index
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
table type possible_keys key key_len ref rows Extra
t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
......@@ -2575,11 +2575,11 @@ companynr companyname
explain select t2.companynr,companyname from t2 left join t4 using (companynr) where t4.companynr is null;
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199
t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists
t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 Using where; Not exists
explain select t2.companynr,companyname from t4 left join t2 using (companynr) where t2.companynr is null;
table type possible_keys key key_len ref rows Extra
t4 ALL NULL NULL NULL NULL 12
t2 ALL NULL NULL NULL NULL 1199 where used; Not exists
t2 ALL NULL NULL NULL NULL 1199 Using where; Not exists
select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
companynr companynr
37 36
......@@ -2587,7 +2587,7 @@ companynr companynr
explain select distinct t2.companynr,t4.companynr from t2,t4 where t2.companynr=t4.companynr+1;
table type possible_keys key key_len ref rows Extra
t2 ALL NULL NULL NULL NULL 1199 Using temporary
t4 index NULL PRIMARY 1 NULL 12 where used; Using index
t4 index NULL PRIMARY 1 NULL 12 Using where; Using index
select t2.fld1,t2.companynr,fld3,period from t3,t2 where t2.fld1 = 38208 and t2.fld1=t3.t2nr and period = 1008 or t2.fld1 = 38008 and t2.fld1 =t3.t2nr and period = 1008;
fld1 companynr fld3 period
038008 37 reporters 1008
......
......@@ -72,3 +72,25 @@ id val elt(two.val,'one','two')
2 1 one
4 2 two
drop table t1,t2;
drop table if exists t1;
CREATE TABLE t1 (
d datetime default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
flush status;
select * from t1 group by d;
d
2002-10-24 14:50:32
2002-10-24 14:50:33
2002-10-24 14:50:34
2002-10-24 14:50:35
2002-10-24 14:50:36
2002-10-24 14:50:37
2002-10-24 14:50:38
2002-10-24 14:50:39
2002-10-24 14:50:40
show status like "created_tmp%tables";
Variable_name Value
Created_tmp_disk_tables 0
Created_tmp_tables 1
drop table t1;
......@@ -76,5 +76,5 @@ date numfacture expedition
0000-00-00 00:00:00 1212 0001-00-00 00:00:00
EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
table type possible_keys key key_len ref rows Extra
t1 ref expedition expedition 8 const 1 where used
t1 ref expedition expedition 8 const 1 Using where
drop table t1;
......@@ -19,14 +19,14 @@ i @vv1:=if(sv1.i,1,0) @vv2:=if(sv2.i,1,0) @vv3:=if(sv3.i,1,0) @vv1+@vv2+@vv3
2 1 0 0 1
explain select * from t1 where i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 ref i i 4 const 1 where used
t1 ref i i 4 const 1 Using where
explain select * from t1 where @vv1:=@vv1+1 and i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 3 where used
t1 ALL NULL NULL NULL NULL 3 Using where
explain select @vv1:=i from t1 where i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 index NULL i 4 NULL 3 where used; Using index
t1 index NULL i 4 NULL 3 Using where; Using index
explain select * from t1 where i=@vv1;
table type possible_keys key key_len ref rows Extra
t1 ref i i 4 const 1 where used
t1 ref i i 4 const 1 Using where
drop table t1,t2;
......@@ -108,7 +108,6 @@ show global variables like 'table_type';
Variable_name Value
table_type INNODB
set GLOBAL query_cache_size=100000;
set GLOBAL safe_show_database=0;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
Variable_name Value
......@@ -276,7 +275,6 @@ set global query_cache_type=demand;
set read_buffer_size=100;
set read_rnd_buffer_size=100;
set global rpl_recovery_rank=100;
set global safe_show_database=1;
set global server_id=100;
set global slave_net_timeout=100;
set global slow_launch_time=100;
......
......@@ -60,3 +60,21 @@ insert into t2 values (1,1),(2,1),(3,1),(4,2);
# do a query using ELT, a join and an ORDER BY.
select one.id, two.val, elt(two.val,'one','two') from t1 one, t2 two where two.id=one.id order by one.id;
drop table t1,t2;
#
# In MySQL 4.0.4 doing a GROUP BY on a NULL column created a disk based
# temporary table when a memory based one would be good enough.
drop table if exists t1;
CREATE TABLE t1 (
d datetime default NULL
) TYPE=MyISAM;
INSERT INTO t1 VALUES ('2002-10-24 14:50:32'),('2002-10-24 14:50:33'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:34'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:35'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:36'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:37'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:38'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:39'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40'),('2002-10-24 14:50:40');
flush status;
select * from t1 group by d;
show status like "created_tmp%tables";
drop table t1;
......@@ -65,7 +65,6 @@ set table_type=MYISAM, table_type="HEAP", global table_type="INNODB";
show local variables like 'table_type';
show global variables like 'table_type';
set GLOBAL query_cache_size=100000;
set GLOBAL safe_show_database=0;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
......@@ -188,7 +187,6 @@ set global query_cache_type=demand;
set read_buffer_size=100;
set read_rnd_buffer_size=100;
set global rpl_recovery_rank=100;
set global safe_show_database=1;
set global server_id=100;
set global slave_net_timeout=100;
set global slow_launch_time=100;
......
......@@ -215,6 +215,7 @@ then
if test -n "$open_files"
then
ulimit -n $open_files
args="open-files-limit=$open_files $args"
fi
if test -n "$core_file_size"
then
......
......@@ -274,7 +274,7 @@ static char* pidfile_name_ptr= pidfile_name;
static pthread_t select_thread;
static my_bool opt_noacl=0, opt_bootstrap=0, opt_myisam_log=0;
my_bool opt_safe_user_create = 0, opt_no_mix_types = 0;
my_bool opt_safe_show_db=0, lower_case_table_names, opt_old_rpl_compat;
my_bool lower_case_table_names, opt_old_rpl_compat;
my_bool opt_show_slave_auth_info, opt_sql_bin_update = 0;
my_bool opt_log_slave_updates= 0;
......@@ -3234,8 +3234,7 @@ struct my_option my_long_options[] =
#ifndef TO_BE_DELETED
{"safe-show-database", OPT_SAFE_SHOW_DB,
"Deprecated option; One should use GRANT SHOW DATABASES instead...",
(gptr*) &opt_safe_show_db, (gptr*) &opt_safe_show_db, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"safe-user-create", OPT_SAFE_USER_CREATE,
"Don't allow new user creation by the user who has no write privileges to the mysql.user table",
......
......@@ -195,8 +195,6 @@ sys_var_thd_enum sys_query_cache_type("query_cache_type",
&SV::query_cache_type,
&query_cache_type_typelib);
#endif /* HAVE_QUERY_CACHE */
sys_var_bool_ptr sys_safe_show_db("safe_show_database",
&opt_safe_show_db);
sys_var_long_ptr sys_server_id("server_id",&server_id);
sys_var_bool_ptr sys_slave_compressed_protocol("slave_compressed_protocol",
&opt_slave_compressed_protocol);
......@@ -356,7 +354,6 @@ sys_var *sys_variables[]=
&sys_read_buff_size,
&sys_read_rnd_buff_size,
&sys_rpl_recovery_rank,
&sys_safe_show_db,
&sys_safe_updates,
&sys_select_limit,
&sys_server_id,
......@@ -499,7 +496,6 @@ struct show_var_st init_vars[]= {
{sys_query_cache_size.name, (char*) &sys_query_cache_size, SHOW_SYS},
{sys_query_cache_type.name, (char*) &sys_query_cache_type, SHOW_SYS},
#endif /* HAVE_QUERY_CACHE */
{sys_safe_show_db.name, (char*) &sys_safe_show_db, SHOW_SYS},
{sys_server_id.name, (char*) &sys_server_id, SHOW_SYS},
{sys_slave_net_timeout.name,(char*) &sys_slave_net_timeout, SHOW_SYS},
{"skip_external_locking", (char*) &my_disable_locking, SHOW_MY_BOOL},
......
......@@ -1732,7 +1732,7 @@ int check_expected_error(THD* thd, RELAY_LOG_INFO* rli, int expected_error)
"Slave: query '%s' partially completed on the master \
and was aborted. There is a chance that your master is inconsistent at this \
point. If you are sure that your master is ok, run this query manually on the\
slave and then restart the slave with SET SQL_SLAVE_SKIP_COUNTER=1;\
slave and then restart the slave with SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;\
SLAVE START;", thd->query);
rli->last_slave_errno = expected_error;
sql_print_error("%s",rli->last_slave_error);
......
......@@ -77,9 +77,10 @@ int mysql_create_db(THD *thd, char *db, uint create_options, bool silent)
{
if (!thd->query)
{
/* The client used the old obsolete mysql_create_db() call */
thd->query = path;
thd->query_length = (uint) (strxmov(path,"create database ", db, NullS)-
path);
thd->query_length = (uint) (strxmov(path,"create database `", db, "`",
NullS) - path);
}
{
mysql_update_log.write(thd,thd->query, thd->query_length);
......
......@@ -3708,7 +3708,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
*blob_field= 0; // End marker
/* If result table is small; use a heap */
if (blob_count || using_unique_constraint || group_null_items ||
if (blob_count || using_unique_constraint ||
(select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) ==
OPTION_BIG_TABLES)
{
......@@ -7193,56 +7193,32 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
{
if (tab->use_quick == 2)
{
sprintf(buff_ptr,"range checked for each record (index map: %u)",
sprintf(buff_ptr,"; Range checked for each record (index map: %u)",
tab->keys);
buff_ptr=strend(buff_ptr);
}
else
buff_ptr=strmov(buff_ptr,"where used");
buff_ptr=strmov(buff_ptr,"; Using where");
}
if (key_read)
{
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Using index");
}
buff_ptr= strmov(buff_ptr,"; Using index");
if (table->reginfo.not_exists_optimize)
{
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Not exists");
}
buff_ptr= strmov(buff_ptr,"; Not exists");
if (need_tmp_table)
{
need_tmp_table=0;
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Using temporary");
buff_ptr= strmov(buff_ptr,"; Using temporary");
}
if (need_order)
{
need_order=0;
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Using filesort");
}
if (distinct & test_all_bits(used_tables,thd->used_tables))
{
if (buff != buff_ptr)
{
buff_ptr[0]=';' ; buff_ptr[1]=' '; buff_ptr+=2;
}
buff_ptr=strmov(buff_ptr,"Distinct");
buff_ptr= strmov(buff_ptr,"; Using filesort");
}
item_list.push_back(new Item_string(buff,(uint) (buff_ptr - buff)));
if (distinct && test_all_bits(used_tables,thd->used_tables))
buff_ptr= strmov(buff_ptr,"; Distinct");
if (buff_ptr == buff)
buff_ptr+= 2;
item_list.push_back(new Item_string(buff+2,(uint) (buff_ptr - buff)-2));
// For next iteration
used_tables|=table->map;
if (result->send_data(item_list))
......
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