configure.in:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
This commit is contained in:
unknown 2000-10-14 03:20:00 +03:00
commit 1198be81c2
48 changed files with 773 additions and 328 deletions

View File

@ -333,7 +333,7 @@ Functionality Missing from MySQL
Foreign Keys Foreign Keys
* Broken Foreign KEY:: Reasons NOT to use foreign keys * Broken Foreign KEY:: Reasons NOT to use foreign keys constraints
The MySQL Access Privilege System The MySQL Access Privilege System
@ -837,7 +837,7 @@ Changes in release 3.23.x (Recommended; beta)
* News-3.23.4:: Changes in release 3.23.4 * News-3.23.4:: Changes in release 3.23.4
* News-3.23.3:: Changes in release 3.23.3 * News-3.23.3:: Changes in release 3.23.3
* News-3.23.2:: Changes in release 3.23.2 * News-3.23.2:: Changes in release 3.23.2
* News-3.23.1:: Changes in release 3.23.1 * News-3.23.1::
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
Changes in release 3.22.x Changes in release 3.22.x
@ -10174,9 +10174,9 @@ To see when @strong{MySQL} might get stored procedures, see @ref{TODO}.
@cindex keys, foreign @cindex keys, foreign
Note that foreign keys in SQL are not used to join tables, but are used Note that foreign keys in SQL are not used to join tables, but are used
mostly for checking referential integrity. If you want to get results from mostly for checking referential integrity (foreign key constraints). If
multiple tables from a @code{SELECT} statement, you do this by joining you want to get results from multiple tables from a @code{SELECT}
tables: statement, you do this by joining tables:
@example @example
SELECT * from table1,table2 where table1.id = table2.id; SELECT * from table1,table2 where table1.id = table2.id;
@ -10203,29 +10203,33 @@ than using foreign keys.
In the near future we will extend the @code{FOREIGN KEY} implementation so In the near future we will extend the @code{FOREIGN KEY} implementation so
that at least the information will be saved in the table specification file that at least the information will be saved in the table specification file
and may be retrieved by @code{mysqldump} and ODBC. and may be retrieved by @code{mysqldump} and ODBC. At a later stage we will
implement the foreign key constraints for application that can't easily be
coded to avoid them.
@menu @menu
* Broken Foreign KEY:: Reasons NOT to use foreign keys * Broken Foreign KEY:: Reasons NOT to use foreign keys constraints
@end menu @end menu
@node Broken Foreign KEY, , Missing Foreign Keys, Missing Foreign Keys @node Broken Foreign KEY, , Missing Foreign Keys, Missing Foreign Keys
@subsubsection Reasons NOT to Use Foreign Keys @subsubsection Reasons NOT to Use Foreign Keys constraints
@cindex foreign keys, reasons not to use @cindex foreign keys, reasons not to use
There are so many problems with foreign keys that we don't There are so many problems with foreign key constraints that we don't
know where to start: know where to start:
@itemize @bullet @itemize @bullet
@item @item
Foreign keys make life very complicated, because the foreign key definitions Foreign key constraints make life very complicated, because the foreign
must be stored in a database and implementing them would destroy the whole key definitions must be stored in a database and implementing them would
``nice approach'' of using files that can be moved, copied, and removed. destroy the whole ``nice approach'' of using files that can be moved,
copied, and removed.
@item @item
The speed impact is terrible for @code{INSERT} and @code{UPDATE} statements, The speed impact is terrible for @code{INSERT} and @code{UPDATE}
and in this case almost all @code{FOREIGN KEY} checks are useless because you statements, and in this case almost all @code{FOREIGN KEY} constraint
usually insert records in the right tables in the right order, anyway. checks are useless because you usually insert records in the right
tables in the right order, anyway.
@item @item
There is also a need to hold locks on many more tables when updating one There is also a need to hold locks on many more tables when updating one
@ -10234,12 +10238,12 @@ MUCH faster to delete records from one table first and subsequently delete
them from the other tables. them from the other tables.
@item @item
You can no longer restore a table by doing a full delete from You can no longer restore a table by doing a full delete from the table
the table and then restoring all records (from a new source or from a backup). and then restoring all records (from a new source or from a backup).
@item @item
If you have foreign keys you can't dump and restore tables unless you do so If you use foreign key constraints you can't dump and restore tables
in a very specific order. unless you do so in a very specific order.
@item @item
It's very easy to do ``allowed'' circular definitions that make the It's very easy to do ``allowed'' circular definitions that make the
@ -10251,9 +10255,11 @@ The only nice aspect of @code{FOREIGN KEY} is that it gives ODBC and some
other client programs the ability to see how a table is connected and to use other client programs the ability to see how a table is connected and to use
this to show connection diagrams and to help in building applicatons. this to show connection diagrams and to help in building applicatons.
@strong{MySQL} will soon store @code{FOREIGN KEY} definitions so that @strong{MySQL} will soon store @code{FOREIGN KEY} definitions so that a
a client can ask for and receive an answer about how the original connection client can ask for and receive an answer about how the original
was made. The current @file{.frm} file format does not have any place for it. connection was made. The current @file{.frm} file format does not have
any place for it. At a later stage we will implement the foreign key
constraints for application that can't easily be coded to avoid them.
@node Missing Views, Missing comments, Missing Foreign Keys, Missing functions @node Missing Views, Missing comments, Missing Foreign Keys, Missing functions
@subsection Views @subsection Views
@ -32285,10 +32291,12 @@ this program!
When started with the @code{--log-slow-queries[=file_name]} option, When started with the @code{--log-slow-queries[=file_name]} option,
@code{mysqld} writes a log file containing all SQL commands that took @code{mysqld} writes a log file containing all SQL commands that took
more than @code{long_query_time} to execute. If no file name is more than @code{long_query_time} to execute. The time to get the initial
given, it defaults to the name of the host machine suffixed with table locks are not counted as execution time.
@code{-slow.log}. If a file name is given, but doesn't contain a path,
the file is written in the data directory. If no file name is given, it defaults to the name of the host machine
suffixed with @code{-slow.log}. If a file name is given, but doesn't
contain a path, the file is written in the data directory.
The slow query log can be used to find queries that takes a long time to The slow query log can be used to find queries that takes a long time to
execute and are thus candidates for optimization. execute and are thus candidates for optimization.
@ -37099,7 +37107,7 @@ Python module with caching. By @email{gandalf@@rosmail.com}.
@item @uref{http://www.mysql.com/Downloads/Contrib/MySQLmodule-1.4.tar.gz, MySQLmodule-1.4.tar.gz} @item @uref{http://www.mysql.com/Downloads/Contrib/MySQLmodule-1.4.tar.gz, MySQLmodule-1.4.tar.gz}
Python interface for @strong{MySQL}. By Joseph Skinner @email{joe@@earthlight.co.nz}; Modified by Joerg Senekowitsch @email{senekow@@ibm.net} Python interface for @strong{MySQL}. By Joseph Skinner @email{joe@@earthlight.co.nz}; Modified by Joerg Senekowitsch @email{senekow@@ibm.net}
@item @uref{http://www.mysql.com/Downloads/Contrib/mysql_mex_1_1b.tar.gz, mysql_mex_1_1b.tar.gz} @item @uref{http://www.mysql.com/Downloads/Contrib/mysql_mex_11.tar.gz, mysql_mex_1_11.tar.gz}
An interface program for the Matlab program by MathWorks. The interface An interface program for the Matlab program by MathWorks. The interface
is done by Kimmo Uutela and John Fisher (not by Mathworks). is done by Kimmo Uutela and John Fisher (not by Mathworks).
Check @uref{http://boojum.hut.fi/~kuutela/mysqlmex.html,mysqlmex.html} Check @uref{http://boojum.hut.fi/~kuutela/mysqlmex.html,mysqlmex.html}
@ -37372,10 +37380,10 @@ Accounting. By Jose de Leon, @email{jdl@@thevision.net}
Apache authentication module for @strong{MySQL}. By Zeev Suraski, Apache authentication module for @strong{MySQL}. By Zeev Suraski,
@email{bourbon@@netvision.net.il}. @email{bourbon@@netvision.net.il}.
@strong{Please} register this module at: @c @strong{Please} register this module at:
@url{http://bourbon.netvision.net.il/mysql/mod_auth_mysql/register.html}. The @c @url{http://bourbon.netvision.net.il/mysql/mod_auth_mysql/register.html}. The
registering information is only used for statistical purposes and will @c registering information is only used for statistical purposes and will
encourage further development of this module! @c encourage further development of this module!
@item @uref{http://www.mysql.com/Downloads/Contrib/mod_log_mysql-1.05.tar.gz, mod_log_mysql-1.05.tar.gz} @item @uref{http://www.mysql.com/Downloads/Contrib/mod_log_mysql-1.05.tar.gz, mod_log_mysql-1.05.tar.gz}
@strong{MySQL} logging module for Apache. By Zeev Suraski, @strong{MySQL} logging module for Apache. By Zeev Suraski,
@ -37526,6 +37534,7 @@ Prints the structure of every table in a database. By Thomas Wana.
@item @uref{http://www.mysql.com/Downloads/Contrib/mysqlsync, mysqlsync-1.0-alpha.tar.gz}. @item @uref{http://www.mysql.com/Downloads/Contrib/mysqlsync, mysqlsync-1.0-alpha.tar.gz}.
A perl script to keep remote copies of a @strong{MySQL} database in sync with a A perl script to keep remote copies of a @strong{MySQL} database in sync with a
central master copy. By Mark Jeftovic. @email{markjr@@easydns.com} central master copy. By Mark Jeftovic. @email{markjr@@easydns.com}
@item @uref{http://www.mysql.com/Downloads/Contrib/MySQLTutor-0.2.tar.gz, MySQLTutor}. @item @uref{http://www.mysql.com/Downloads/Contrib/MySQLTutor-0.2.tar.gz, MySQLTutor}.
MySQLTutor. A tutor of @strong{MySQL} for beginners MySQLTutor. A tutor of @strong{MySQL} for beginners
@ -37547,6 +37556,9 @@ By Elizabeth.
@item @uref{http://www.mysql.com/Downloads/Contrib/mybackup} @item @uref{http://www.mysql.com/Downloads/Contrib/mybackup}
@item @uref{http://www.mswanson.com/mybackup, mybackup home page} @item @uref{http://www.mswanson.com/mybackup, mybackup home page}
Wrapper for mysqldump to backup all databases. By Marc Swanson. Wrapper for mysqldump to backup all databases. By Marc Swanson.
@item @uref{http://www.mysql.com/Downloads/Contrib/mdu.pl.gz,mdu.pl.gz}
Prints the storage usage of a @strong{MySQL} database.
@end itemize @end itemize
@cindex RPMs, for common tools @cindex RPMs, for common tools
@ -37949,7 +37961,7 @@ though, so 3.23 is not released as a stable version yet.
* News-3.23.4:: Changes in release 3.23.4 * News-3.23.4:: Changes in release 3.23.4
* News-3.23.3:: Changes in release 3.23.3 * News-3.23.3:: Changes in release 3.23.3
* News-3.23.2:: Changes in release 3.23.2 * News-3.23.2:: Changes in release 3.23.2
* News-3.23.1:: Changes in release 3.23.2 * News-3.23.1:: Changes in release 3.23.1
* News-3.23.0:: Changes in release 3.23.0 * News-3.23.0:: Changes in release 3.23.0
@end menu @end menu
@ -37957,6 +37969,14 @@ though, so 3.23 is not released as a stable version yet.
@appendixsubsec Changes in release 3.23.26 @appendixsubsec Changes in release 3.23.26
@itemize @bullet @itemize @bullet
@item @item
@code{LEFT JOIN} did in some case prefer a full table scan when one
didn't have a @code{WHERE} clause.
@item
When using @code{--log-slow-queries}, don't count the time waiting for a lock.
@item
Fixed bug in lock code on @code{windows} which could cause the key cache
to report that the key file was crashed even if it was ok.
@item
Automatic repair of @code{MyISAM} tables if you start @code{mysqld} with Automatic repair of @code{MyISAM} tables if you start @code{mysqld} with
@code{--myisam-recover}. @code{--myisam-recover}.
@item @item
@ -42319,12 +42339,20 @@ Allow users to change startup options.
@item @item
Subqueries. @code{select id from t where grp in (select grp from g where u > 100)} Subqueries. @code{select id from t where grp in (select grp from g where u > 100)}
@item @item
@code{INSERT SQL_CONCURRENT ...}; This will force the insert to happen at the
end of the data file if the table is in use by an select to allow
concurrent inserts.
@item
Change @code{INSERT ... SELECT} to use concurrent inserts.
@item
Add range checking to @code{MERGE} tables. Add range checking to @code{MERGE} tables.
@item @item
@code{SHOW OPEN TABLES} @code{SHOW OPEN TABLES}
@item @item
Port of @strong{MySQL} to BeOS. Port of @strong{MySQL} to BeOS.
@item @item
Link the @code{myisampack} code into the server.
@item
Add a temporary key buffer cache during @code{insert/delete/update} so that we Add a temporary key buffer cache during @code{insert/delete/update} so that we
can gracefully recover if the index file gets full. can gracefully recover if the index file gets full.
@item @item

View File

@ -446,7 +446,8 @@ static my_bool execute_commands(MYSQL *mysql,int argc, char **argv)
case ADMIN_REFRESH: case ADMIN_REFRESH:
if (mysql_refresh(mysql, if (mysql_refresh(mysql,
(uint) ~(REFRESH_GRANT | REFRESH_STATUS | (uint) ~(REFRESH_GRANT | REFRESH_STATUS |
REFRESH_READ_LOCK)) < 0) REFRESH_READ_LOCK | REFRESH_SLAVE |
REFRESH_MASTER)) < 0)
{ {
my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL), my_printf_error(0,"refresh failed; error: '%s'",MYF(ME_BELL),
mysql_error(mysql)); mysql_error(mysql));

View File

@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
AC_INIT(sql/mysqld.cc) AC_INIT(sql/mysqld.cc)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
# The Docs Makefile.am parses this line! # The Docs Makefile.am parses this line!
AM_INIT_AUTOMAKE(mysql, 3.23.25-beta) AM_INIT_AUTOMAKE(mysql, 3.23.26-beta)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
PROTOCOL_VERSION=10 PROTOCOL_VERSION=10
@ -662,7 +662,7 @@ case $SYSTEM_TYPE in
;; ;;
*hpux11.*) *hpux11.*)
echo "Enabling pread/pwrite workaround for hpux 11" echo "Enabling pread/pwrite workaround for hpux 11"
CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE" CFLAGS="$CFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -DHAVE_BROKEN_GETPASS"
CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG" CXXFLAGS="$CXXFLAGS -DHAVE_BROKEN_PREAD -DDONT_USE_FINITE -D_INCLUDE_LONGLONG"
if test "$with_named_thread" = "no" if test "$with_named_thread" = "no"
then then

View File

@ -17,7 +17,7 @@
/* Return error-text for system error messages and nisam messages */ /* Return error-text for system error messages and nisam messages */
#define PERROR_VERSION "2.5" #define PERROR_VERSION "2.6"
#include <global.h> #include <global.h>
#include <my_sys.h> #include <my_sys.h>
@ -62,7 +62,7 @@ static HA_ERRORS ha_errlist[]=
{ 138,"Unsupported extension used for table" }, { 138,"Unsupported extension used for table" },
{ 139,"Too big row (>= 16 M)"}, { 139,"Too big row (>= 16 M)"},
{ 140,"Wrong create options"}, { 140,"Wrong create options"},
{ 141,"Duplicate unique on write or update"}, { 141,"Duplicate unique key or constraint on write or update"},
{ 142,"Unknown character set used"}, { 142,"Unknown character set used"},
{ 143,"Conflicting table definition between MERGE and mapped table"}, { 143,"Conflicting table definition between MERGE and mapped table"},
{ 144,"Table is crashed and last repair failed"}, { 144,"Table is crashed and last repair failed"},

View File

@ -76,7 +76,7 @@ int pthread_attr_setprio(pthread_attr_t *connect_att,int priority);
int pthread_attr_destroy(pthread_attr_t *connect_att); int pthread_attr_destroy(pthread_attr_t *connect_att);
struct tm *localtime_r(const time_t *timep,struct tm *tmp); struct tm *localtime_r(const time_t *timep,struct tm *tmp);
void pthread_exit(unsigned A); /* was #define pthread_exit(A) ExitThread(A)*/ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#define ETIMEDOUT 145 /* Win32 doesn't have this */ #define ETIMEDOUT 145 /* Win32 doesn't have this */
#define getpid() GetCurrentThreadId() #define getpid() GetCurrentThreadId()

View File

@ -177,18 +177,19 @@ int mi_lock_database(MI_INFO *info, int lock_type)
if (!share->w_locks) if (!share->w_locks)
{ {
flag=1; flag=1;
VOID(my_seek(share->kfile,0L,MY_SEEK_SET,MYF(0))); if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,
if (my_lock(share->kfile,lock_type,0L,F_TO_EOF,info->lock_wait)) info->lock_wait | MY_SEEK_NOT_DONE))
{ {
error=my_errno; error=my_errno;
break; break;
} }
if (!share->r_locks) if (!share->r_locks)
{ {
if (mi_state_info_read_dsk(share->kfile, &share->state, 0)) if (mi_state_info_read_dsk(share->kfile, &share->state, 1))
{ {
error=my_errno; error=my_errno;
VOID(my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,info->lock_wait)); VOID(my_lock(share->kfile,F_UNLCK,0L,F_TO_EOF,
info->lock_wait | MY_SEEK_NOT_DONE));
my_errno=error; my_errno=error;
break; break;
} }

View File

@ -128,8 +128,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
} }
if (memavl < MIN_SORT_MEMORY) if (memavl < MIN_SORT_MEMORY)
{ {
mi_check_print_error(info->sort_info->param,"Sort buffer to small"); mi_check_print_error(info->sort_info->param,"Sort buffer to small"); /* purecov: tested */
goto err; goto err; /* purecov: tested */
} }
(*info->lock_in_memory)(info->sort_info->param);/* Everything is allocated */ (*info->lock_in_memory)(info->sort_info->param);/* Everything is allocated */
@ -138,13 +138,13 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if ((records=find_all_keys(info,keys,sort_keys,buffpek,&maxbuffer,&tempfile)) if ((records=find_all_keys(info,keys,sort_keys,buffpek,&maxbuffer,&tempfile))
== HA_POS_ERROR) == HA_POS_ERROR)
goto err; goto err; /* purecov: tested */
if (maxbuffer == 0) if (maxbuffer == 0)
{ {
if (!no_messages) if (!no_messages)
printf(" - Dumping %lu keys\n",records); printf(" - Dumping %lu keys\n",records);
if (write_index(info,sort_keys,(uint) records)) if (write_index(info,sort_keys,(uint) records))
goto err; goto err; /* purecov: inspected */
} }
else else
{ {
@ -152,17 +152,17 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if (maxbuffer >= MERGEBUFF2) if (maxbuffer >= MERGEBUFF2)
{ {
if (!no_messages) if (!no_messages)
printf(" - Merging %lu keys\n",records); printf(" - Merging %lu keys\n",records); /* purecov: tested */
if (merge_many_buff(info,keys,sort_keys,buffpek,&maxbuffer,&tempfile)) if (merge_many_buff(info,keys,sort_keys,buffpek,&maxbuffer,&tempfile))
goto err; goto err; /* purecov: inspected */
} }
if (flush_io_cache(&tempfile) || if (flush_io_cache(&tempfile) ||
reinit_io_cache(&tempfile,READ_CACHE,0L,0,0)) reinit_io_cache(&tempfile,READ_CACHE,0L,0,0))
goto err; goto err; /* purecov: inspected */
if (!no_messages) if (!no_messages)
puts(" - Last merge and dumping keys"); puts(" - Last merge and dumping keys"); /* purecov: tested */
if (merge_index(info,keys,sort_keys,buffpek,maxbuffer,&tempfile)) if (merge_index(info,keys,sort_keys,buffpek,maxbuffer,&tempfile))
goto err; goto err; /* purecov: inspected */
} }
error =0; error =0;
@ -195,17 +195,17 @@ static ha_rows NEAR_F find_all_keys(MI_SORT_PARAM *info, uint keys,
{ {
if (indexpos >= (uint) *maxbuffer || if (indexpos >= (uint) *maxbuffer ||
write_keys(info,sort_keys,idx-1,buffpek+indexpos,tempfile)) write_keys(info,sort_keys,idx-1,buffpek+indexpos,tempfile))
DBUG_RETURN((ha_rows) -1); DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
memcpy(sort_keys[0],sort_keys[idx-1],(size_t) info->key_length); memcpy(sort_keys[0],sort_keys[idx-1],(size_t) info->key_length);
idx=1; indexpos++; idx=1; indexpos++;
} }
} }
if (error > 0) if (error > 0)
DBUG_RETURN(HA_POS_ERROR); /* Aborted by get_key */ DBUG_RETURN(HA_POS_ERROR); /* Aborted by get_key */ /* purecov: inspected */
if (indexpos) if (indexpos)
if (indexpos >= (uint) *maxbuffer || if (indexpos >= (uint) *maxbuffer ||
write_keys(info,sort_keys,idx,buffpek+indexpos,tempfile)) write_keys(info,sort_keys,idx,buffpek+indexpos,tempfile))
DBUG_RETURN(HA_POS_ERROR); DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
*maxbuffer=(int) indexpos; *maxbuffer=(int) indexpos;
DBUG_RETURN(indexpos*(keys-1)+idx); DBUG_RETURN(indexpos*(keys-1)+idx);
} /* find_all_keys */ } /* find_all_keys */
@ -226,13 +226,13 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
if (!my_b_inited(tempfile) && if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, info->tmpdir, "ST", DISK_BUFFER_SIZE, open_cached_file(tempfile, info->tmpdir, "ST", DISK_BUFFER_SIZE,
info->myf_rw)) info->myf_rw))
DBUG_RETURN(1); DBUG_RETURN(1); /* purecov: inspected */
buffpek->file_pos=my_b_tell(tempfile); buffpek->file_pos=my_b_tell(tempfile);
buffpek->count=count; buffpek->count=count;
for (end=sort_keys+count ; sort_keys != end ; sort_keys++) for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
if (my_b_write(tempfile,(byte*) *sort_keys,(uint) sort_length)) if (my_b_write(tempfile,(byte*) *sort_keys,(uint) sort_length))
DBUG_RETURN(1); DBUG_RETURN(1); /* purecov: inspected */
DBUG_RETURN(0); DBUG_RETURN(0);
} /* write_keys */ } /* write_keys */
@ -248,7 +248,7 @@ static int NEAR_F write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
(qsort2_cmp) info->key_cmp,info->sort_info); (qsort2_cmp) info->key_cmp,info->sort_info);
while (count--) while (count--)
if ((*info->key_write)(info->sort_info,*sort_keys++)) if ((*info->key_write)(info->sort_info,*sort_keys++))
DBUG_RETURN(-1); DBUG_RETURN(-1); /* purecov: inspected */
DBUG_RETURN(0); DBUG_RETURN(0);
} /* write_index */ } /* write_index */
@ -281,11 +281,11 @@ static int NEAR_F merge_many_buff(MI_SORT_PARAM *info, uint keys,
{ {
if (merge_buffers(info,keys,from_file,to_file,sort_keys,lastbuff++, if (merge_buffers(info,keys,from_file,to_file,sort_keys,lastbuff++,
buffpek+i,buffpek+i+MERGEBUFF-1)) buffpek+i,buffpek+i+MERGEBUFF-1))
break; break; /* purecov: inspected */
} }
if (merge_buffers(info,keys,from_file,to_file,sort_keys,lastbuff++, if (merge_buffers(info,keys,from_file,to_file,sort_keys,lastbuff++,
buffpek+i,buffpek+ *maxbuffer)) buffpek+i,buffpek+ *maxbuffer))
break; break; /* purecov: inspected */
if (flush_io_cache(to_file)) if (flush_io_cache(to_file))
break; /* purecov: inspected */ break; /* purecov: inspected */
temp=from_file; from_file=to_file; to_file=temp; temp=from_file; from_file=to_file; to_file=temp;
@ -350,19 +350,19 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0, if (init_queue(&queue,(uint) (Tb-Fb)+1,offsetof(BUFFPEK,key),0,
(int (*)(void*, byte *,byte*)) info->key_cmp, (int (*)(void*, byte *,byte*)) info->key_cmp,
(void*) info->sort_info)) (void*) info->sort_info))
DBUG_RETURN(1); DBUG_RETURN(1); /* purecov: inspected */
for (buffpek= Fb ; buffpek <= Tb && error != -1 ; buffpek++) for (buffpek= Fb ; buffpek <= Tb ; buffpek++)
{ {
count+= buffpek->count; count+= buffpek->count;
buffpek->base= strpos; buffpek->base= strpos;
buffpek->max_keys=maxcount; buffpek->max_keys=maxcount;
strpos+= (uint) (error=(int) read_to_buffer(from_file,buffpek, strpos+= (uint) (error=(int) read_to_buffer(from_file,buffpek,
sort_length)); sort_length));
if (error == -1)
goto err; /* purecov: inspected */
queue_insert(&queue,(void*) buffpek); queue_insert(&queue,(void*) buffpek);
} }
if (error == -1)
goto err;
while (queue.elements > 1) while (queue.elements > 1)
{ {
@ -373,14 +373,14 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{ {
if (my_b_write(to_file,(byte*) buffpek->key,(uint) sort_length)) if (my_b_write(to_file,(byte*) buffpek->key,(uint) sort_length))
{ {
error=1; goto err; error=1; goto err; /* purecov: inspected */
} }
} }
else else
{ {
if ((*info->key_write)(info->sort_info,(void*) buffpek->key)) if ((*info->key_write)(info->sort_info,(void*) buffpek->key))
{ {
error=1; goto err; error=1; goto err; /* purecov: inspected */
} }
} }
buffpek->key+=sort_length; buffpek->key+=sort_length;
@ -429,7 +429,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
if (my_b_write(to_file,(byte*) buffpek->key, if (my_b_write(to_file,(byte*) buffpek->key,
(sort_length*buffpek->mem_count))) (sort_length*buffpek->mem_count)))
{ {
error=1; goto err; error=1; goto err; /* purecov: inspected */
} }
} }
else else
@ -442,7 +442,7 @@ merge_buffers(MI_SORT_PARAM *info, uint keys, IO_CACHE *from_file,
{ {
if ((*info->key_write)(info->sort_info,(void*) strpos)) if ((*info->key_write)(info->sort_info,(void*) strpos))
{ {
error=1; goto err; error=1; goto err; /* purecov: inspected */
} }
} }
} }
@ -468,7 +468,7 @@ merge_index(MI_SORT_PARAM *info, uint keys, uchar **sort_keys,
DBUG_ENTER("merge_index"); DBUG_ENTER("merge_index");
if (merge_buffers(info,keys,tempfile,(IO_CACHE*) 0,sort_keys,buffpek,buffpek, if (merge_buffers(info,keys,tempfile,(IO_CACHE*) 0,sort_keys,buffpek,buffpek,
buffpek+maxbuffer)) buffpek+maxbuffer))
DBUG_RETURN(1); DBUG_RETURN(1); /* purecov: inspected */
DBUG_RETURN(0); DBUG_RETURN(0);
} /* merge_index */ } /* merge_index */

View File

@ -43,7 +43,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
DBUG_ENTER("open_temp_file"); DBUG_ENTER("open_temp_file");
#if defined(_MSC_VER) #if defined(_MSC_VER)
{ {
char *end,*res,**old_env,*temp_env[1]; char temp[FN_REFLEN],*end,*res,**old_env,*temp_env[1];
old_env=environ; old_env=environ;
if (dir) if (dir)
{ {

View File

@ -109,10 +109,17 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length,
printf("Error: DosSetFileLocks() == %d\n",rc); printf("Error: DosSetFileLocks() == %d\n",rc);
} }
#elif defined(HAVE_LOCKING) #elif defined(HAVE_LOCKING)
if (MyFlags & MY_SEEK_NOT_DONE) /* Windows */
VOID(my_seek(fd,start,MY_SEEK_SET,MYF(MyFlags & ~MY_SEEK_NOT_DONE))); {
if (!locking(fd,locktype,(ulong) length) || errno == EINVAL) my_bool error;
DBUG_RETURN(0); pthread_mutex_lock(&my_file_info[fd].mutex);
if (MyFlags & MY_SEEK_NOT_DONE)
VOID(my_seek(fd,start,MY_SEEK_SET,MYF(MyFlags & ~MY_SEEK_NOT_DONE)));
error= locking(fd,locktype,(ulong) length) && errno != EINVAL;
pthread_mutex_unlock(&my_file_info[fd].mutex);
if (!error)
DBUG_RETURN(0);
}
#else #else
#if defined(HAVE_FCNTL) #if defined(HAVE_FCNTL)
lock.l_type= (short) locktype; lock.l_type= (short) locktype;

View File

@ -61,7 +61,7 @@ static pthread_handler_decl(pthread_start,param)
win_pthread_self=((struct pthread_map *) param)->pthreadself; win_pthread_self=((struct pthread_map *) param)->pthreadself;
pthread_mutex_unlock(&THR_LOCK_thread); pthread_mutex_unlock(&THR_LOCK_thread);
free((char*) param); /* Free param from create */ free((char*) param); /* Free param from create */
pthread_exit((*func)(func_param)); pthread_exit((void*) (*func)(func_param));
return 0; /* Safety */ return 0; /* Safety */
} }
@ -103,7 +103,7 @@ int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
} }
void pthread_exit(unsigned A) void pthread_exit(void *a)
{ {
_endthread(); _endthread();
} }

View File

@ -0,0 +1,19 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 0:30:52
ATIS table test
Creating tables
Time for create_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
Time to insert (9768): 4 wallclock secs ( 0.66 usr 0.60 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data
Time for select_simple_join (500): 2 wallclock secs ( 0.64 usr 0.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_join (200): 13 wallclock secs ( 4.22 usr 3.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_distinct (800): 11 wallclock secs ( 1.68 usr 1.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (2800): 10 wallclock secs ( 1.54 usr 0.65 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Removing tables
Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 40 wallclock secs ( 8.74 usr 5.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,19 +1,19 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 2:53:29 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 14:00:43
ATIS table test ATIS table test
Creating tables Creating tables
Time for create_table (28): 0 wallclock secs ( 0.00 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_table (28): 1 wallclock secs ( 0.02 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data Inserting data
Time to insert (9768): 5 wallclock secs ( 0.86 usr 1.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert (9768): 5 wallclock secs ( 1.06 usr 1.22 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data Retrieving data
Time for select_simple_join (500): 4 wallclock secs ( 1.75 usr 0.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_simple_join (500): 3 wallclock secs ( 1.56 usr 0.66 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_join (200): 22 wallclock secs (13.38 usr 5.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_join (200): 23 wallclock secs (13.31 usr 5.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_distinct (800): 17 wallclock secs ( 4.75 usr 1.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_distinct (800): 17 wallclock secs ( 4.36 usr 2.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (2800): 21 wallclock secs ( 3.16 usr 1.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_group (2800): 20 wallclock secs ( 3.14 usr 1.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Removing tables Removing tables
Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to drop_table (28): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 69 wallclock secs (23.89 usr 9.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 69 wallclock secs (23.45 usr 11.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -0,0 +1,86 @@
Benchmark DBD suite: 2.9
Date of test: 2000-10-13 0:30:52
Running tests on: Linux 2.2.13-SMP alpha
Arguments:
Comments: Alpha DS20 2x500 MHz, 2G memory, key_buffer=16M; gcc 2.95.2 + ccc
Limits from:
Server version: MySQL 3.23.25 beta
ATIS: Total time: 40 wallclock secs ( 8.74 usr 5.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
alter-table: Total time: 435 wallclock secs ( 0.29 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
big-tables: Total time: 41 wallclock secs ( 8.36 usr 10.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
connect: Total time: 76 wallclock secs (34.42 usr 12.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
create: Total time: 135 wallclock secs (10.37 usr 4.56 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
insert: Total time: 1756 wallclock secs (370.65 usr 171.18 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
select: Total time: 1982 wallclock secs (130.60 usr 108.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
wisconsin: Total time: 19 wallclock secs ( 3.67 usr 2.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
All 8 test executed successfully
Totals per operation:
Operation seconds usr sys cpu tests
alter_table_add 238.00 0.17 0.07 0.00 992
alter_table_drop 189.00 0.06 0.04 0.00 496
connect 13.00 7.52 2.74 0.00 10000
connect+select_1_row 16.00 7.90 3.25 0.00 10000
connect+select_simple 16.00 7.94 3.21 0.00 10000
count 53.00 0.04 0.01 0.00 100
count_distinct 94.00 0.64 0.20 0.00 1000
count_distinct_big 851.00 79.09 89.50 0.00 1020
count_distinct_group 69.00 1.13 0.58 0.00 1000
count_distinct_group_on_key 48.00 0.37 0.16 0.00 1000
count_distinct_group_on_key_parts 69.00 1.10 0.62 0.00 1000
count_group_on_key_parts 44.00 1.15 0.58 0.00 1000
count_on_key 452.00 15.84 4.57 0.00 50100
create+drop 13.00 2.72 1.19 0.00 10000
create_MANY_tables 91.00 1.80 0.61 0.00 10000
create_index 4.00 0.00 0.00 0.00 8
create_key+drop 17.00 4.20 1.25 0.00 10000
create_table 0.00 0.00 0.00 0.00 31
delete_all 11.00 0.00 0.00 0.00 12
delete_all_many_keys 49.00 0.01 0.00 0.00 1
delete_big 0.00 0.00 0.00 0.00 1
delete_big_many_keys 49.00 0.01 0.00 0.00 128
delete_key 5.00 0.68 0.58 0.00 10000
drop_index 4.00 0.00 0.00 0.00 8
drop_table 0.00 0.00 0.00 0.00 28
drop_table_when_MANY_tables 7.00 0.69 0.60 0.00 10000
insert 132.00 22.47 20.01 0.00 350768
insert_duplicates 40.00 6.20 6.19 0.00 100000
insert_key 95.00 8.49 5.48 0.00 100000
insert_many_fields 14.00 0.34 0.12 0.00 2000
insert_select_1_key 5.00 0.00 0.00 0.00 1
insert_select_2_keys 7.00 0.00 0.00 0.00 1
min_max 23.00 0.03 0.00 0.00 60
min_max_on_key 188.00 25.65 7.76 0.00 85000
multiple_value_insert 7.00 2.08 0.05 0.00 100000
order_by 51.00 21.06 22.46 0.00 10
order_by_key 36.00 20.39 14.82 0.00 10
outer_join 65.00 0.00 0.00 0.00 10
outer_join_found 60.00 0.00 0.00 0.00 10
outer_join_not_found 38.00 0.01 0.00 0.00 500
outer_join_on_key 42.00 0.00 0.00 0.00 10
select_1_row 3.00 0.38 1.04 0.00 10000
select_2_rows 3.00 0.35 0.96 0.00 10000
select_big 56.00 30.32 15.00 0.00 10080
select_column+column 3.00 0.32 0.73 0.00 10000
select_diff_key 175.00 0.24 0.05 0.00 500
select_distinct 11.00 1.68 1.02 0.00 800
select_group 51.00 1.59 0.66 0.00 2911
select_group_when_MANY_tables 7.00 0.95 0.90 0.00 10000
select_join 13.00 4.22 3.17 0.00 200
select_key 141.00 74.40 21.54 0.00 200000
select_key2 146.00 76.95 20.42 0.00 200000
select_key_prefix 146.00 76.59 19.98 0.00 200000
select_many_fields 27.00 8.01 10.15 0.00 2000
select_range 269.00 9.47 5.61 0.00 410
select_range_key2 19.00 6.47 2.37 0.00 25010
select_range_prefix 20.00 6.54 2.29 0.00 25010
select_simple 2.00 0.28 0.79 0.00 10000
select_simple_join 2.00 0.64 0.38 0.00 500
update_big 28.00 0.00 0.00 0.00 10
update_of_key 44.00 2.93 2.56 0.00 50256
update_of_key_big 19.00 0.04 0.03 0.00 501
update_with_key 139.00 23.06 19.06 0.00 300000
wisc_benchmark 4.00 1.75 0.93 0.00 114
TOTALS 4533.00 566.96 316.29 0.00 1944607

View File

@ -1,79 +1,86 @@
Benchmark DBD suite: 2.9 Benchmark DBD suite: 2.9
Date of test: 2000-09-27 2:14:34 Date of test: 2000-10-13 13:16:20
Running tests on: Windows NT Version 4.0 Running tests on: Windows NT Version 4.0
Arguments: Arguments:
Comments: 2x Pentium III XEON 450MHZ, 512M Comments: 2x Pentium III XEON 450MHZ, 512M
Limits from: Limits from:
Server version: MySQL 3.23.25 beta Server version: MySQL 3.23.26 gamma
alter-table: Total time: 2334 wallclock secs ( 0.75 usr 0.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU) alter-table: Total time: 2663 wallclock secs ( 0.73 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
ATIS: Total time: 69 wallclock secs (23.89 usr 9.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU) ATIS: Total time: 69 wallclock secs (23.45 usr 11.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
big-tables: Total time: 80 wallclock secs (17.56 usr 18.45 sys + 0.00 cusr 0.00 csys = 0.00 CPU) big-tables: Total time: 80 wallclock secs (17.59 usr 18.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
connect: Total time: 183 wallclock secs (59.48 usr 50.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU) connect: Total time: 178 wallclock secs (57.88 usr 48.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
create: Failed (output/create-mysql-NT_4.0) create: Total time: 848 wallclock secs (14.42 usr 10.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
insert: Total time: 5829 wallclock secs (581.28 usr 317.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU) insert: Total time: 5599 wallclock secs (584.97 usr 320.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
select: Total time: 2397 wallclock secs (317.05 usr 117.49 sys + 0.00 cusr 0.00 csys = 0.00 CPU) select: Total time: 2294 wallclock secs (316.44 usr 121.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
wisconsin: Total time: 28 wallclock secs ( 8.19 usr 5.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU) wisconsin: Total time: 28 wallclock secs ( 8.39 usr 5.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Of 8 tests, 1 tests didn't work All 8 test executed successfully
Totals per operation: Totals per operation:
Operation seconds usr sys cpu tests Operation seconds usr sys cpu tests
alter_table_add 1242.00 0.42 0.17 0.00 992 alter_table_add 1433.00 0.45 0.34 0.00 992
alter_table_drop 1042.00 0.25 0.25 0.00 496 alter_table_drop 1177.00 0.17 0.14 0.00 496
connect 32.00 10.92 11.08 0.00 10000 connect 33.00 11.66 10.31 0.00 10000
connect+select_1_row 38.00 12.33 12.44 0.00 10000 connect+select_1_row 38.00 12.94 12.19 0.00 10000
connect+select_simple 37.00 12.31 11.61 0.00 10000 connect+select_simple 38.00 12.14 12.00 0.00 10000
count 39.00 0.06 0.02 0.00 100 count 34.00 0.11 0.03 0.00 100
count_distinct 97.00 0.97 0.36 0.00 1000 count_distinct 74.00 0.95 0.28 0.00 1000
count_distinct_big 1209.00 225.82 83.41 0.00 1020 count_distinct_big 1191.00 227.87 86.22 0.00 1020
count_distinct_group 144.00 2.70 0.98 0.00 1000 count_distinct_group 149.00 2.50 1.00 0.00 1000
count_distinct_group_on_key 54.00 0.61 0.23 0.00 1000 count_distinct_group_on_key 40.00 0.63 0.27 0.00 1000
count_distinct_group_on_key_parts 144.00 2.44 1.28 0.00 1000 count_distinct_group_on_key_parts 149.00 2.95 1.06 0.00 1000
count_group_on_key_parts 47.00 2.34 0.75 0.00 1000 count_group_on_key_parts 41.00 2.72 0.84 0.00 1000
count_on_key 438.00 22.47 8.91 0.00 50100 count_on_key 407.00 20.91 9.02 0.00 50100
create_index 26.00 0.00 0.00 0.00 8 create+drop 124.00 3.22 2.39 0.00 10000
create_table 0.00 0.00 0.02 0.00 31 create_MANY_tables 213.00 2.77 1.67 0.00 10000
delete_all 22.00 0.00 0.00 0.00 12 create_index 27.00 0.00 0.00 0.00 8
delete_all_many_keys 1498.00 0.02 0.01 0.00 1 create_key+drop 159.00 5.92 2.61 0.00 10000
create_table 1.00 0.02 0.02 0.00 31
delete_all 22.00 0.00 0.02 0.00 12
delete_all_many_keys 1422.00 0.00 0.00 0.00 1
delete_big 0.00 0.00 0.00 0.00 1 delete_big 0.00 0.00 0.00 0.00 1
delete_big_many_keys 1498.00 0.02 0.01 0.00 128 delete_big_many_keys 1422.00 0.00 0.00 0.00 128
delete_key 7.00 0.97 1.25 0.00 10000 delete_key 7.00 0.97 1.36 0.00 10000
drop_index 24.00 0.00 0.02 0.00 8 drop_index 25.00 0.00 0.02 0.00 8
drop_table 0.00 0.00 0.00 0.00 28 drop_table 0.00 0.00 0.00 0.00 28
insert 234.00 34.55 46.33 0.00 350768 drop_table_when_MANY_tables 159.00 1.22 1.27 0.00 10000
insert_duplicates 59.00 6.50 10.52 0.00 300000 insert 252.00 34.77 46.66 0.00 350768
insert_key 1593.00 14.31 14.47 0.00 100000 insert_duplicates 59.00 8.11 13.67 0.00 100000
insert_many_fields 22.00 0.52 0.42 0.00 2000 insert_key 1447.00 13.78 13.42 0.00 100000
min_max 20.00 0.05 0.03 0.00 60 insert_many_fields 22.00 0.55 0.35 0.00 2000
min_max_on_key 211.00 37.06 13.64 0.00 85000 insert_select_1_key 8.00 0.00 0.00 0.00 1
multiple_value_insert 9.00 2.51 0.24 0.00 100000 insert_select_2_keys 13.00 0.00 0.00 0.00 1
order_by 99.00 63.39 25.81 0.00 10 min_max 18.00 0.11 0.02 0.00 60
order_by_key 89.00 63.61 25.09 0.00 10 min_max_on_key 192.00 36.01 14.60 0.00 85000
outer_join 120.00 0.00 0.00 0.00 10 multiple_value_insert 9.00 2.34 0.26 0.00 100000
outer_join_found 106.00 0.01 0.00 0.00 10 order_by 98.00 63.58 25.14 0.00 10
outer_join_not_found 55.00 0.00 0.00 0.00 500 order_by_key 90.00 64.05 25.08 0.00 10
outer_join 118.00 0.01 0.00 0.00 10
outer_join_found 105.00 0.00 0.00 0.00 10
outer_join_not_found 56.00 0.00 0.00 0.00 500
outer_join_on_key 40.00 0.00 0.00 0.00 10 outer_join_on_key 40.00 0.00 0.00 0.00 10
select_1_row 5.00 1.13 1.70 0.00 10000 select_1_row 5.00 0.78 1.78 0.00 10000
select_2_rows 6.00 0.97 1.97 0.00 10000 select_2_rows 6.00 0.91 2.11 0.00 10000
select_big 144.00 84.41 33.61 0.00 10080 select_big 138.00 81.45 32.88 0.00 10080
select_column+column 6.00 1.06 1.67 0.00 10000 select_column+column 6.00 1.00 1.72 0.00 10000
select_diff_key 123.00 0.39 0.08 0.00 500 select_diff_key 124.00 0.41 0.09 0.00 500
select_distinct 17.00 4.75 1.78 0.00 800 select_distinct 17.00 4.36 2.64 0.00 800
select_group 61.00 3.29 1.15 0.00 2911 select_group 56.00 3.22 1.16 0.00 2911
select_join 22.00 13.38 5.28 0.00 200 select_group_when_MANY_tables 193.00 1.28 2.25 0.00 10000
select_key 193.00 92.27 38.89 0.00 200000 select_join 23.00 13.31 5.59 0.00 200
select_key2 202.00 93.95 37.08 0.00 200000 select_key 196.00 96.84 36.63 0.00 200000
select_key_prefix 198.00 91.75 40.53 0.00 200000 select_key2 203.00 92.92 39.80 0.00 200000
select_many_fields 55.00 17.05 18.03 0.00 2000 select_key_prefix 201.00 91.41 40.78 0.00 200000
select_range 187.00 27.56 9.31 0.00 410 select_many_fields 56.00 17.03 18.35 0.00 2000
select_range_key2 29.00 10.02 3.90 0.00 25010 select_range 189.00 26.94 9.30 0.00 410
select_range_prefix 28.00 10.74 3.92 0.00 25010 select_range_key2 30.00 10.56 3.72 0.00 25010
select_simple 4.00 0.86 1.70 0.00 10000 select_range_prefix 26.00 9.81 4.36 0.00 25010
select_simple_join 4.00 1.75 0.53 0.00 500 select_simple 4.00 1.05 1.67 0.00 10000
update_big 64.00 0.00 0.00 0.00 500 select_simple_join 3.00 1.56 0.66 0.00 500
update_of_key 541.00 4.83 6.56 0.00 756 update_big 62.00 0.00 0.00 0.00 10
update_of_key_big 34.00 0.08 0.05 0.00 501 update_of_key 492.00 4.46 7.55 0.00 50256
update_with_key 185.00 24.97 40.99 0.00 100000 update_of_key_big 33.00 0.06 0.03 0.00 501
wisc_benchmark 9.00 5.80 1.64 0.00 114 update_with_key 188.00 25.03 40.83 0.00 300000
TOTALS 12412.00 1008.17 519.72 0.00 1845595 wisc_benchmark 9.00 5.80 1.47 0.00 114
TOTALS 13172.00 1023.62 537.63 0.00 1944607

View File

@ -0,0 +1,16 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 0:31:33
Testing of ALTER TABLE
Testing with 1000 columns and 1000 rows in 20 steps
Insert data into the table
Time for insert (1000) 0 wallclock secs ( 0.06 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_add (992): 238 wallclock secs ( 0.17 usr 0.07 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop_index (8): 4 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_drop (496): 189 wallclock secs ( 0.06 usr 0.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 435 wallclock secs ( 0.29 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,16 +1,16 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 2:14:35 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 13:16:20
Testing of ALTER TABLE Testing of ALTER TABLE
Testing with 1000 columns and 1000 rows in 20 steps Testing with 1000 columns and 1000 rows in 20 steps
Insert data into the table Insert data into the table
Time for insert (1000) 0 wallclock secs ( 0.06 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert (1000) 1 wallclock secs ( 0.11 usr 0.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_add (992): 1242 wallclock secs ( 0.42 usr 0.17 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for alter_table_add (992): 1433 wallclock secs ( 0.45 usr 0.34 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_index (8): 26 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_index (8): 27 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop_index (8): 24 wallclock secs ( 0.00 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for drop_index (8): 25 wallclock secs ( 0.00 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for alter_table_drop (496): 1042 wallclock secs ( 0.25 usr 0.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for alter_table_drop (496): 1177 wallclock secs ( 0.17 usr 0.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 2334 wallclock secs ( 0.75 usr 0.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 2663 wallclock secs ( 0.73 usr 0.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -0,0 +1,19 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 0:38:49
Testing of some unusual tables
All tests are done 1000 times with 1000 fields
Testing table with 1000 fields
Testing select * from table with 1 record
Time to select_many_fields(1000): 11 wallclock secs ( 3.96 usr 5.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select all_fields from table with 1 record
Time to select_many_fields(1000): 16 wallclock secs ( 4.05 usr 5.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert VALUES()
Time to insert_many_fields(1000): 5 wallclock secs ( 0.31 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert (all_fields) VALUES()
Time to insert_many_fields(1000): 9 wallclock secs ( 0.03 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 41 wallclock secs ( 8.36 usr 10.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,19 +1,19 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 2:54:38 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 14:01:53
Testing of some unusual tables Testing of some unusual tables
All tests are done 1000 times with 1000 fields All tests are done 1000 times with 1000 fields
Testing table with 1000 fields Testing table with 1000 fields
Testing select * from table with 1 record Testing select * from table with 1 record
Time to select_many_fields(1000): 19 wallclock secs ( 8.08 usr 9.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_many_fields(1000): 20 wallclock secs ( 8.03 usr 9.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select all_fields from table with 1 record Testing select all_fields from table with 1 record
Time to select_many_fields(1000): 36 wallclock secs ( 8.97 usr 8.94 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_many_fields(1000): 36 wallclock secs ( 9.00 usr 8.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert VALUES() Testing insert VALUES()
Time to insert_many_fields(1000): 3 wallclock secs ( 0.44 usr 0.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert_many_fields(1000): 3 wallclock secs ( 0.39 usr 0.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert (all_fields) VALUES() Testing insert (all_fields) VALUES()
Time to insert_many_fields(1000): 19 wallclock secs ( 0.08 usr 0.33 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert_many_fields(1000): 19 wallclock secs ( 0.16 usr 0.22 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 80 wallclock secs (17.56 usr 18.45 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 80 wallclock secs (17.59 usr 18.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -0,0 +1,30 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 0:39:31
Testing the speed of connecting to the server and sending of data
All tests are done 10000 times
Testing connection/disconnect
Time to connect (10000): 13 wallclock secs ( 7.52 usr 2.74 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test connect/simple select/disconnect
Time for connect+select_simple (10000): 16 wallclock secs ( 7.94 usr 3.21 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test simple select
Time for select_simple (10000): 2 wallclock secs ( 0.28 usr 0.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing connect/select 1 row from table/disconnect
Time to connect+select_1_row (10000): 16 wallclock secs ( 7.90 usr 3.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 1 row from table
Time to select_1_row (10000): 3 wallclock secs ( 0.38 usr 1.04 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 2 rows from table
Time to select_2_rows (10000): 3 wallclock secs ( 0.35 usr 0.96 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test select with aritmetic (+)
Time for select_column+column (10000): 3 wallclock secs ( 0.32 usr 0.73 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing retrieval of big records (65000 bytes)
Time to select_big (10000): 20 wallclock secs ( 9.73 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 76 wallclock secs (34.42 usr 12.79 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,30 +1,30 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 2:55:59 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 14:03:13
Testing the speed of connecting to the server and sending of data Testing the speed of connecting to the server and sending of data
All tests are done 10000 times All tests are done 10000 times
Testing connection/disconnect Testing connection/disconnect
Time to connect (10000): 32 wallclock secs (10.92 usr 11.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to connect (10000): 33 wallclock secs (11.66 usr 10.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test connect/simple select/disconnect Test connect/simple select/disconnect
Time for connect+select_simple (10000): 37 wallclock secs (12.31 usr 11.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for connect+select_simple (10000): 38 wallclock secs (12.14 usr 12.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test simple select Test simple select
Time for select_simple (10000): 4 wallclock secs ( 0.86 usr 1.70 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_simple (10000): 4 wallclock secs ( 1.05 usr 1.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing connect/select 1 row from table/disconnect Testing connect/select 1 row from table/disconnect
Time to connect+select_1_row (10000): 38 wallclock secs (12.33 usr 12.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to connect+select_1_row (10000): 38 wallclock secs (12.94 usr 12.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 1 row from table Testing select 1 row from table
Time to select_1_row (10000): 5 wallclock secs ( 1.13 usr 1.70 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_1_row (10000): 5 wallclock secs ( 0.78 usr 1.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing select 2 rows from table Testing select 2 rows from table
Time to select_2_rows (10000): 6 wallclock secs ( 0.97 usr 1.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_2_rows (10000): 6 wallclock secs ( 0.91 usr 2.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test select with aritmetic (+) Test select with aritmetic (+)
Time for select_column+column (10000): 6 wallclock secs ( 1.06 usr 1.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_column+column (10000): 6 wallclock secs ( 1.00 usr 1.72 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing retrieval of big records (65000 bytes) Testing retrieval of big records (65000 bytes)
Time to select_big (10000): 55 wallclock secs (19.89 usr 8.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to select_big (10000): 48 wallclock secs (17.38 usr 7.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 183 wallclock secs (59.48 usr 50.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 178 wallclock secs (57.88 usr 48.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -0,0 +1,18 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 0:40:47
Testing the speed of creating and droping tables
Testing with 10000 tables and 10000 loop count
Testing create of tables
Time for create_MANY_tables (10000): 91 wallclock secs ( 1.80 usr 0.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Accessing tables
Time to select_group_when_MANY_tables (10000): 7 wallclock secs ( 0.95 usr 0.90 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing drop
Time for drop_table_when_MANY_tables (10000): 7 wallclock secs ( 0.69 usr 0.60 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing create+drop
Time for create+drop (10000): 13 wallclock secs ( 2.72 usr 1.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_key+drop (10000): 17 wallclock secs ( 4.20 usr 1.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 135 wallclock secs (10.37 usr 4.56 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,6 +1,18 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 2:59:02 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 14:06:11
Testing the speed of creating and droping tables Testing the speed of creating and droping tables
Testing with 10000 tables and 10000 loop count Testing with 10000 tables and 10000 loop count
Testing create of tables Testing create of tables
Time for create_MANY_tables (10000): 213 wallclock secs ( 2.77 usr 1.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Accessing tables
Time to select_group_when_MANY_tables (10000): 193 wallclock secs ( 1.28 usr 2.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing drop
Time for drop_table_when_MANY_tables (10000): 159 wallclock secs ( 1.22 usr 1.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing create+drop
Time for create+drop (10000): 124 wallclock secs ( 3.22 usr 2.39 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for create_key+drop (10000): 159 wallclock secs ( 5.92 usr 2.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 848 wallclock secs (14.42 usr 10.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -0,0 +1,79 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 0:43:02
Testing the speed of inserting data into 1 table and do some selects on it.
The tests are done with a table that has 100000 rows.
Generating random keys
Creating tables
Inserting 100000 rows in order
Inserting 100000 rows in reverse order
Inserting 100000 rows in random order
Time for insert (300000): 110 wallclock secs (19.18 usr 17.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert of duplicates
Time for insert_duplicates (100000): 40 wallclock secs ( 6.20 usr 6.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data from the table
Time for select_big (10:3000000): 35 wallclock secs (20.45 usr 14.85 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key (10:3000000): 36 wallclock secs (20.39 usr 14.82 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by (10:3000000): 51 wallclock secs (21.06 usr 22.46 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_diff_key (500:1000): 175 wallclock secs ( 0.24 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_prefix (5010:42084): 11 wallclock secs ( 2.81 usr 0.93 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (5010:42084): 10 wallclock secs ( 2.78 usr 1.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix (200000): 146 wallclock secs (76.59 usr 19.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key (200000): 141 wallclock secs (74.40 usr 21.54 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key2 (200000): 146 wallclock secs (76.95 usr 20.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test of compares with simple ranges
Time for select_range_prefix (20000:43500): 9 wallclock secs ( 3.73 usr 1.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (20000:43500): 9 wallclock secs ( 3.69 usr 1.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (111): 41 wallclock secs ( 0.05 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (15000): 10 wallclock secs ( 4.68 usr 1.32 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max (60): 23 wallclock secs ( 0.03 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (100): 38 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count (100): 53 wallclock secs ( 0.04 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (20): 58 wallclock secs ( 0.00 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys with functions
Time for update_of_key (50000): 22 wallclock secs ( 2.91 usr 2.54 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_of_key_big (501): 19 wallclock secs ( 0.04 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update with key
Time for update_with_key (300000): 139 wallclock secs (23.06 usr 19.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of all rows
Time for update_big (10): 28 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing left outer join
Time for outer_join_on_key (10:10): 42 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join (10:10): 65 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_found (10:10): 60 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_not_found (500:10): 38 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing INSERT INTO ... SELECT
Time for insert_select_1_key (1): 5 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert_select_2_keys (1): 7 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(2): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing delete
Time for delete_key (10000): 5 wallclock secs ( 0.68 usr 0.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_all (12): 11 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Insert into table with 16 keys and with a primary key with 16 parts
Time for insert_key (100000): 95 wallclock secs ( 8.49 usr 5.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys
Time for update_of_key (256): 22 wallclock secs ( 0.02 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting rows from the table
Time for delete_big_many_keys (128): 49 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting everything from table
Time for delete_all_many_keys (1): 49 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting 100000 rows with multiple values
Time for multiple_value_insert (100000): 7 wallclock secs ( 2.08 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 1756 wallclock secs (370.65 usr 171.18 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,4 +1,4 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 2:59:03 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 14:20:19
Testing the speed of inserting data into 1 table and do some selects on it. Testing the speed of inserting data into 1 table and do some selects on it.
The tests are done with a table that has 100000 rows. The tests are done with a table that has 100000 rows.
@ -8,67 +8,72 @@ Creating tables
Inserting 100000 rows in order Inserting 100000 rows in order
Inserting 100000 rows in reverse order Inserting 100000 rows in reverse order
Inserting 100000 rows in random order Inserting 100000 rows in random order
Time for insert (300000): 203 wallclock secs (30.05 usr 40.38 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert (300000): 221 wallclock secs (30.06 usr 39.92 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing insert of duplicates Testing insert of duplicates
Time for insert_duplicates (300000): 59 wallclock secs ( 6.50 usr 10.52 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert_duplicates (100000): 59 wallclock secs ( 8.11 usr 13.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Retrieving data from the table Retrieving data from the table
Time for select_big (10:3000000): 88 wallclock secs (64.08 usr 24.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_big (10:3000000): 89 wallclock secs (63.69 usr 25.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by_key (10:3000000): 89 wallclock secs (63.61 usr 25.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by_key (10:3000000): 90 wallclock secs (64.05 usr 25.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for order_by (10:3000000): 99 wallclock secs (63.39 usr 25.81 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for order_by (10:3000000): 98 wallclock secs (63.58 usr 25.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_diff_key (500:1000): 123 wallclock secs ( 0.39 usr 0.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_diff_key (500:1000): 124 wallclock secs ( 0.41 usr 0.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_prefix (5010:42084): 15 wallclock secs ( 5.30 usr 1.48 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_prefix (5010:42084): 14 wallclock secs ( 4.47 usr 1.89 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (5010:42084): 16 wallclock secs ( 4.69 usr 1.74 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_key2 (5010:42084): 16 wallclock secs ( 4.64 usr 1.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key_prefix (200000): 198 wallclock secs (91.75 usr 40.53 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_key_prefix (200000): 201 wallclock secs (91.41 usr 40.78 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key (200000): 193 wallclock secs (92.27 usr 38.89 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_key (200000): 196 wallclock secs (96.84 usr 36.63 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_key2 (200000): 202 wallclock secs (93.95 usr 37.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_key2 (200000): 203 wallclock secs (92.92 usr 39.80 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Test of compares with simple ranges Test of compares with simple ranges
Time for select_range_prefix (20000:43500): 13 wallclock secs ( 5.44 usr 2.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_prefix (20000:43500): 12 wallclock secs ( 5.34 usr 2.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range_key2 (20000:43500): 13 wallclock secs ( 5.33 usr 2.16 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range_key2 (20000:43500): 14 wallclock secs ( 5.92 usr 1.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_group (111): 40 wallclock secs ( 0.13 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_group (111): 36 wallclock secs ( 0.08 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (15000): 14 wallclock secs ( 6.51 usr 2.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for min_max_on_key (15000): 14 wallclock secs ( 6.45 usr 2.63 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max (60): 20 wallclock secs ( 0.05 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for min_max (60): 18 wallclock secs ( 0.11 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (100): 36 wallclock secs ( 0.05 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_on_key (100): 36 wallclock secs ( 0.03 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count (100): 39 wallclock secs ( 0.06 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count (100): 34 wallclock secs ( 0.11 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (20): 92 wallclock secs ( 0.05 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_big (20): 96 wallclock secs ( 0.01 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys with functions Testing update of keys with functions
Time for update_of_key (500): 62 wallclock secs ( 4.77 usr 6.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_of_key (50000): 56 wallclock secs ( 4.45 usr 7.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for update_of_key_big (501): 34 wallclock secs ( 0.08 usr 0.05 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_of_key_big (501): 33 wallclock secs ( 0.06 usr 0.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update with key Testing update with key
Time for update_with_key (100000): 185 wallclock secs (24.97 usr 40.99 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_with_key (300000): 188 wallclock secs (25.03 usr 40.83 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of all rows Testing update of all rows
Time for update_big (500): 64 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_big (10): 62 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing left outer join Testing left outer join
Time for outer_join_on_key (10:10): 40 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join_on_key (10:10): 40 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join (10:10): 120 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join (10:10): 118 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_found (10:10): 106 wallclock secs ( 0.01 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join_found (10:10): 105 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for outer_join_not_found (500:10): 55 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for outer_join_not_found (500:10): 56 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing INSERT INTO ... SELECT
Time for insert_select_1_key (1): 8 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for insert_select_2_keys (1): 13 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(2): 0 wallclock secs ( 0.02 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing delete Testing delete
Time for delete_key (10000): 7 wallclock secs ( 0.97 usr 1.25 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_key (10000): 7 wallclock secs ( 0.97 usr 1.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for delete_all (12): 22 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_all (12): 22 wallclock secs ( 0.00 usr 0.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Insert into table with 16 keys and with a primary key with 16 parts Insert into table with 16 keys and with a primary key with 16 parts
Time for insert_key (100000): 1593 wallclock secs (14.31 usr 14.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for insert_key (100000): 1447 wallclock secs (13.78 usr 13.42 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing update of keys Testing update of keys
Time for update_of_key (256): 479 wallclock secs ( 0.06 usr 0.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for update_of_key (256): 436 wallclock secs ( 0.01 usr 0.08 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting rows from the table Deleting rows from the table
Time for delete_big_many_keys (128): 1498 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_big_many_keys (128): 1422 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Deleting everything from table Deleting everything from table
Time for delete_all_many_keys (1): 1498 wallclock secs ( 0.02 usr 0.01 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for delete_all_many_keys (1): 1422 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting 100000 rows with multiple values Inserting 100000 rows with multiple values
Time for multiple_value_insert (100000): 9 wallclock secs ( 2.51 usr 0.24 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for multiple_value_insert (100000): 9 wallclock secs ( 2.34 usr 0.26 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for drop table(1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 5829 wallclock secs (581.28 usr 317.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 5599 wallclock secs (584.97 usr 320.95 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -0,0 +1,23 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 1:12:21
Testing the speed of selecting on keys that consist of many parts
The test-table has 10000 rows and the test is done with 500 ranges.
Creating table
Inserting 10000 rows
Time to insert (10000): 3 wallclock secs ( 0.72 usr 0.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing big selects on the table
Time for select_big (70:17207): 1 wallclock secs ( 0.14 usr 0.09 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range (410:1057904): 269 wallclock secs ( 9.47 usr 5.61 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (70000): 178 wallclock secs (20.97 usr 6.44 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (50000): 414 wallclock secs (15.80 usr 4.56 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_group_on_key_parts (1000:0): 44 wallclock secs ( 1.15 usr 0.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing count(distinct) on the table
Time for count_distinct (1000:2000): 94 wallclock secs ( 0.64 usr 0.20 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key (1000:6000): 48 wallclock secs ( 0.37 usr 0.16 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key_parts (1000:100000): 69 wallclock secs ( 1.10 usr 0.62 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group (1000:100000): 69 wallclock secs ( 1.13 usr 0.58 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (1000:10000000): 793 wallclock secs (79.09 usr 89.49 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 1982 wallclock secs (130.60 usr 108.91 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,23 +1,23 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 4:36:14 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 15:53:40
Testing the speed of selecting on keys that consist of many parts Testing the speed of selecting on keys that consist of many parts
The test-table has 10000 rows and the test is done with 500 ranges. The test-table has 10000 rows and the test is done with 500 ranges.
Creating table Creating table
Inserting 10000 rows Inserting 10000 rows
Time to insert (10000): 7 wallclock secs ( 1.25 usr 1.03 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert (10000): 7 wallclock secs ( 1.06 usr 1.39 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing big selects on the table Testing big selects on the table
Time for select_big (70:17207): 1 wallclock secs ( 0.44 usr 0.11 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_big (70:17207): 1 wallclock secs ( 0.38 usr 0.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for select_range (410:1057904): 187 wallclock secs (27.56 usr 9.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for select_range (410:1057904): 189 wallclock secs (26.94 usr 9.30 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for min_max_on_key (70000): 197 wallclock secs (30.55 usr 11.14 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for min_max_on_key (70000): 178 wallclock secs (29.56 usr 11.97 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_on_key (50000): 402 wallclock secs (22.42 usr 8.89 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_on_key (50000): 371 wallclock secs (20.88 usr 9.02 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_group_on_key_parts (1000:0): 47 wallclock secs ( 2.34 usr 0.75 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_group_on_key_parts (1000:0): 41 wallclock secs ( 2.72 usr 0.84 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Testing count(distinct) on the table Testing count(distinct) on the table
Time for count_distinct (1000:2000): 97 wallclock secs ( 0.97 usr 0.36 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct (1000:2000): 74 wallclock secs ( 0.95 usr 0.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key (1000:6000): 54 wallclock secs ( 0.61 usr 0.23 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_group_on_key (1000:6000): 40 wallclock secs ( 0.63 usr 0.27 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group_on_key_parts (1000:100000): 144 wallclock secs ( 2.44 usr 1.28 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_group_on_key_parts (1000:100000): 149 wallclock secs ( 2.95 usr 1.06 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_group (1000:100000): 144 wallclock secs ( 2.70 usr 0.98 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_group (1000:100000): 149 wallclock secs ( 2.50 usr 1.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time for count_distinct_big (1000:10000000): 1117 wallclock secs (225.77 usr 83.39 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for count_distinct_big (1000:10000000): 1095 wallclock secs (227.86 usr 86.19 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 2397 wallclock secs (317.05 usr 117.49 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 2294 wallclock secs (316.44 usr 121.50 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -0,0 +1,14 @@
Testing server 'MySQL 3.23.25 beta' at 2000-10-13 1:45:23
Wisconsin benchmark test
Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data
Time to insert (31000): 15 wallclock secs ( 1.91 usr 1.77 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Running actual benchmark
Time for wisc_benchmark (114): 4 wallclock secs ( 1.75 usr 0.93 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 19 wallclock secs ( 3.67 usr 2.69 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -1,14 +1,14 @@
Testing server 'MySQL 3.23.25 beta' at 2000-09-27 5:16:11 Testing server 'MySQL 3.23.26 gamma' at 2000-10-13 16:31:55
Wisconsin benchmark test Wisconsin benchmark test
Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for create_table (3): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Inserting data Inserting data
Time to insert (31000): 19 wallclock secs ( 2.39 usr 3.67 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to insert (31000): 19 wallclock secs ( 2.59 usr 4.13 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time to delete_big (1): 0 wallclock secs ( 0.00 usr 0.00 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Running actual benchmark Running actual benchmark
Time for wisc_benchmark (114): 9 wallclock secs ( 5.80 usr 1.64 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Time for wisc_benchmark (114): 9 wallclock secs ( 5.80 usr 1.47 sys + 0.00 cusr 0.00 csys = 0.00 CPU)
Total time: 28 wallclock secs ( 8.19 usr 5.31 sys + 0.00 cusr 0.00 csys = 0.00 CPU) Total time: 28 wallclock secs ( 8.39 usr 5.59 sys + 0.00 cusr 0.00 csys = 0.00 CPU)

View File

@ -39,7 +39,7 @@
# "3-byte int" or "same as xxx". # "3-byte int" or "same as xxx".
$version="1.49"; $version="1.50";
use DBI; use DBI;
use Getopt::Long; use Getopt::Long;
@ -271,8 +271,9 @@ if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))"))
report("Alter table alter column default",'alter_alter_col', report("Alter table alter column default",'alter_alter_col',
"alter table crash_q alter b set default 10", "alter table crash_q alter b set default 10",
"alter table crash_q alter b set default NULL"); "alter table crash_q alter b set default NULL");
report("Alter table drop column",'alter_drop_col', report_one("Alter table drop column",'alter_drop_col',
"alter table crash_q drop column b"); [["alter table crash_q drop column b","yes"],
["alter table crash_q drop column b restrict","with restrict/cascade"]]);
report("Alter table rename table",'alter_rename_table', report("Alter table rename table",'alter_rename_table',
"alter table crash_q rename to crash_q1"); "alter table crash_q rename to crash_q1");
} }
@ -757,7 +758,7 @@ try_and_report("Automatic rowid", "automatic_rowid",
["COS","cos","cos(0)","1.00000",0], ["COS","cos","cos(0)","1.00000",0],
["COT","cot","cot(1)","0.64209262",0], ["COT","cot","cot(1)","0.64209262",0],
["DEGREES","degrees","degrees(6.283185)","360",0], ["DEGREES","degrees","degrees(6.283185)","360",0],
["EXP","exp","exp(1)","2.718282",0], ["EXP","exp","exp(1.0)","2.718282",0],
["FLOOR","floor","floor(2.5)","2",0], ["FLOOR","floor","floor(2.5)","2",0],
["LOG","log","log(2)","0.693147",0], ["LOG","log","log(2)","0.693147",0],
["LOG10","log10","log10(10)","1",0], ["LOG10","log10","log10(10)","1",0],
@ -1047,7 +1048,11 @@ if ($limits{'functions'} eq 'yes')
print "\n"; print "\n";
report("mixing of integer and float in expression","float_int_expr", report("mixing of integer and float in expression","float_int_expr",
"select 1+1.0 $end_query"); "select 1+1.0 $end_query");
if ($limits{'func_odbc_exp'} eq 'yes')
{
report("No need to cast from integer to float",
"dont_require_cast_to_float", "select exp(1) $end_query");
}
check_and_report("Is 1+NULL = NULL","null_num_expr", check_and_report("Is 1+NULL = NULL","null_num_expr",
[],"select 1+$numeric_null $end_query",[],undef(),4); [],"select 1+$numeric_null $end_query",[],undef(),4);
$tmp=sql_concat("'a'",$char_null); $tmp=sql_concat("'a'",$char_null);
@ -1269,9 +1274,10 @@ report("temporary tables",'tempoary_table',
"create temporary table crash_q (q integer not null)", "create temporary table crash_q (q integer not null)",
"drop table crash_q"); "drop table crash_q");
report("create table from select",'create_table_select', report_one("create table from select",'create_table_select',
"create table crash_q SELECT * from crash_me", [["create table crash_q SELECT * from crash_me","yes"],
"drop table crash_q"); ["create table crash_q AS SELECT * from crash_me","with AS"]]);
$dbh->do("drop table crash_q");
report("index in create table",'index_in_create', report("index in create table",'index_in_create',
"create table crash_q (q integer not null,index (q))", "create table crash_q (q integer not null,index (q))",
@ -1628,9 +1634,9 @@ if (!report("many tables to drop table","multi_drop",
} }
report("-- as comment","comment_--", report("-- as comment (ANSI)","comment_--",
"select * from crash_me -- Testing of comments"); "select * from crash_me -- Testing of comments");
report("// as comment","comment_//", report("// as comment (ANSI)","comment_//",
"select * from crash_me // Testing of comments"); "select * from crash_me // Testing of comments");
report("# as comment","comment_#", report("# as comment","comment_#",
"select * from crash_me # Testing of comments"); "select * from crash_me # Testing of comments");

View File

@ -1,4 +1,4 @@
#This file is automaticly generated by crash-me 1.49 #This file is automaticly generated by crash-me 1.50
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
@ -27,16 +27,16 @@ column_alias=yes # Column alias
columns_in_group_by=+64 # number of columns in group by columns_in_group_by=+64 # number of columns in group by
columns_in_order_by=+64 # number of columns in order by columns_in_order_by=+64 # number of columns in order by
comment_#=yes # # as comment comment_#=yes # # as comment
comment_--=yes # -- as comment comment_--=yes # -- as comment (ANSI)
comment_/**/=yes # /* */ as comment comment_/**/=yes # /* */ as comment
comment_//=no # // as comment comment_//=no # // as comment (ANSI)
compute=no # Compute compute=no # Compute
connections=30 # Simultaneous connections (installation default) connections=30 # Simultaneous connections (installation default)
constraint_check=no # Column constraints constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=no # crash me safe crash_me_safe=yes # crash me safe
crash_me_version=1.49 # crash me version crash_me_version=1.50 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
@ -51,6 +51,7 @@ date_one=yes # Supports 0001-01-01 dates
date_with_YY=yes # Supports YY-MM-DD 2000 compilant dates date_with_YY=yes # Supports YY-MM-DD 2000 compilant dates
date_zero=yes # Supports 0000-00-00 dates date_zero=yes # Supports 0000-00-00 dates
domains=no # Domains (ANSI SQL) domains=no # Domains (ANSI SQL)
dont_require_cast_to_float=yes # No need to cast from integer to float
double_quotes=yes # Double '' as ' in strings double_quotes=yes # Double '' as ' in strings
drop_if_exists=yes # drop table if exists drop_if_exists=yes # drop table if exists
drop_index=with 'ON' # drop index drop_index=with 'ON' # drop index

View File

@ -1,4 +1,4 @@
#This file is automaticly generated by crash-me 1.49 #This file is automaticly generated by crash-me 1.50
NEG=yes # update of column= -column NEG=yes # update of column= -column
Need_cast_for_null=no # Need to cast NULL for arithmetic Need_cast_for_null=no # Need to cast NULL for arithmetic
@ -27,16 +27,16 @@ column_alias=yes # Column alias
columns_in_group_by=+64 # number of columns in group by columns_in_group_by=+64 # number of columns in group by
columns_in_order_by=+64 # number of columns in order by columns_in_order_by=+64 # number of columns in order by
comment_#=yes # # as comment comment_#=yes # # as comment
comment_--=yes # -- as comment comment_--=yes # -- as comment (ANSI)
comment_/**/=yes # /* */ as comment comment_/**/=yes # /* */ as comment
comment_//=no # // as comment comment_//=no # // as comment (ANSI)
compute=no # Compute compute=no # Compute
connections=30 # Simultaneous connections (installation default) connections=30 # Simultaneous connections (installation default)
constraint_check=no # Column constraints constraint_check=no # Column constraints
constraint_check_table=no # Table constraints constraint_check_table=no # Table constraints
constraint_null=yes # NULL constraint (SyBase style) constraint_null=yes # NULL constraint (SyBase style)
crash_me_safe=no # crash me safe crash_me_safe=yes # crash me safe
crash_me_version=1.49 # crash me version crash_me_version=1.50 # crash me version
create_default=yes # default value for column create_default=yes # default value for column
create_default_func=no # default value function for column create_default_func=no # default value function for column
create_if_not_exists=yes # create table if not exists create_if_not_exists=yes # create table if not exists
@ -51,6 +51,7 @@ date_one=yes # Supports 0001-01-01 dates
date_with_YY=yes # Supports YY-MM-DD 2000 compilant dates date_with_YY=yes # Supports YY-MM-DD 2000 compilant dates
date_zero=yes # Supports 0000-00-00 dates date_zero=yes # Supports 0000-00-00 dates
domains=no # Domains (ANSI SQL) domains=no # Domains (ANSI SQL)
dont_require_cast_to_float=yes # No need to cast from integer to float
double_quotes=yes # Double '' as ' in strings double_quotes=yes # Double '' as ' in strings
drop_if_exists=yes # drop table if exists drop_if_exists=yes # drop table if exists
drop_index=with 'ON' # drop index drop_index=with 'ON' # drop index

View File

@ -161,7 +161,7 @@ print_match("Order by and group by","order|having|group");
print_match("Join methods",'join|subqueries|multi_table|select_table_update'); print_match("Join methods",'join|subqueries|multi_table|select_table_update');
print_match("String handling","string|select_constant|quote_with|double_quotes|end_space"); print_match("String handling","string|select_constant|quote_with|double_quotes|end_space");
print_match("Quoting","quote"); print_match("Quoting","quote");
print_match("Name limits","name"); print_match("Name limits","name","alter");
print_match("Index limits",'index|primary|unique'); print_match("Index limits",'index|primary|unique');
print_match("Type limits",'char|float|binary|text_size|date|end_space'); print_match("Type limits",'char|float|binary|text_size|date|end_space');
print_match("Expression limits",'expression|conditions|select_limit'); print_match("Expression limits",'expression|conditions|select_limit');

View File

@ -901,6 +901,16 @@ if ($limits->{'insert_select'})
$end_time=new Benchmark; $end_time=new Benchmark;
print "Time for drop table(2): " . print "Time for drop table(2): " .
timestr(timediff($end_time, $loop_time),"all") . "\n"; timestr(timediff($end_time, $loop_time),"all") . "\n";
if ($opt_fast && defined($server->{vacuum}))
{
$server->vacuum(1,\$dbh);
}
if ($server->small_rollback_segment())
{
$dbh->disconnect; # close connection
$dbh = $server->connect();
}
} }

View File

@ -4550,7 +4550,7 @@ Field *make_field(char *ptr, uint32 field_length,
/* Create a field suitable for create of table */ /* Create a field suitable for create of table */
create_field::create_field(Field *old_field,bool ignore_default) create_field::create_field(Field *old_field,Field *orig_field)
{ {
field= old_field; field= old_field;
field_name=change=old_field->field_name; field_name=change=old_field->field_name;
@ -4574,15 +4574,24 @@ create_field::create_field(Field *old_field,bool ignore_default)
interval= ((Field_enum*) old_field)->typelib; interval= ((Field_enum*) old_field)->typelib;
else else
interval=0; interval=0;
if (!ignore_default && !old_field->is_real_null() && ! (flags & BLOB_FLAG) && if (!old_field->is_real_null() && ! (flags & BLOB_FLAG) &&
old_field->type() != FIELD_TYPE_TIMESTAMP && old_field->ptr) old_field->type() != FIELD_TYPE_TIMESTAMP && old_field->ptr &&
orig_field)
{ {
char buff[MAX_FIELD_WIDTH],*pos; char buff[MAX_FIELD_WIDTH],*pos;
String tmp(buff,sizeof(buff)); String tmp(buff,sizeof(buff)),*res;
field->val_str(&tmp,&tmp);
pos= (char*) sql_memdup(tmp.ptr(),tmp.length()+1); /* Get the value from record[2] (the default value row) */
pos[tmp.length()]=0; my_ptrdiff_t diff= (my_ptrdiff_t) (orig_field->table->rec_buff_length*2);
def=new Item_string(pos,tmp.length()); orig_field->move_field(diff); // Points now at record[2]
res=orig_field->val_str(&tmp,&tmp);
orig_field->move_field(-diff); // Back to record[0]
if (res) // If not NULL value
{
pos= (char*) sql_memdup(tmp.ptr(),tmp.length()+1);
pos[tmp.length()]=0;
def=new Item_string(pos,tmp.length());
}
} }
else else
def=0; def=0;

View File

@ -986,7 +986,7 @@ public:
uint8 row,col,sc_length,interval_id; // For rea_create_table uint8 row,col,sc_length,interval_id; // For rea_create_table
uint offset,pack_flag; uint offset,pack_flag;
create_field() :after(0) {} create_field() :after(0) {}
create_field(Field *field,bool ignore_default=0); create_field(Field *field, Field *orig_field);
}; };

View File

@ -578,7 +578,7 @@ void MYSQL_LOG::write(THD *thd,const char *query, uint query_length,
/* For slow query log */ /* For slow query log */
if (!(specialflag & SPECIAL_LONG_LOG_FORMAT)) if (!(specialflag & SPECIAL_LONG_LOG_FORMAT))
current_time=time(NULL); current_time=time(NULL);
fprintf(file,"# Time: %lu Lock_time: %lu Rows_sent %lu\n", fprintf(file,"# Time: %lu Lock_time: %lu Rows_sent: %lu\n",
(ulong) (current_time - query_start), (ulong) (current_time - query_start),
(ulong) (thd->time_after_lock - query_start), (ulong) (thd->time_after_lock - query_start),
(ulong) thd->sent_row_count); (ulong) thd->sent_row_count);

View File

@ -264,22 +264,22 @@ void Log_event::print_header(FILE* file)
fprintf(file, " server id %ld ", server_id); fprintf(file, " server id %ld ", server_id);
} }
void Log_event::print_timestamp(FILE* file, time_t* ts = 0) void Log_event::print_timestamp(FILE* file, time_t* ts)
{ {
struct tm tm_tmp; struct tm tm_tmp;
if(!ts) if (!ts)
{ {
ts = &when; ts = &when;
} }
localtime_r(ts,&tm_tmp); localtime_r(ts,&tm_tmp);
fprintf(file,"%02d%02d%02d %2d:%02d:%02d", fprintf(file,"%02d%02d%02d %2d:%02d:%02d",
tm_tmp.tm_year % 100, tm_tmp.tm_year % 100,
tm_tmp.tm_mon+1, tm_tmp.tm_mon+1,
tm_tmp.tm_mday, tm_tmp.tm_mday,
tm_tmp.tm_hour, tm_tmp.tm_hour,
tm_tmp.tm_min, tm_tmp.tm_min,
tm_tmp.tm_sec); tm_tmp.tm_sec);
} }

View File

@ -327,7 +327,7 @@ static void dump_local_log_entries(const char* logname)
if(!position) if(!position)
{ {
char magic[4]; char magic[4];
if(my_fread(file, magic, sizeof(magic), MYF(MY_NABP|MY_WME))) if(my_fread(file, (byte*) magic, sizeof(magic), MYF(MY_NABP|MY_WME)))
die("I/O error reading binlog magic number"); die("I/O error reading binlog magic number");
if(memcmp(magic, BINLOG_MAGIC, 4)) if(memcmp(magic, BINLOG_MAGIC, 4))
die("Bad magic number"); die("Bad magic number");

View File

@ -2916,12 +2916,11 @@ static void get_options(int argc,char **argv)
default_table_type=DB_TYPE_ISAM; default_table_type=DB_TYPE_ISAM;
myisam_delay_key_write=0; myisam_delay_key_write=0;
myisam_concurrent_insert=0; myisam_concurrent_insert=0;
myisam_recover_options= 0; myisam_recover_options= HA_RECOVER_NONE;
break; break;
case (int) OPT_SAFE: case (int) OPT_SAFE:
opt_specialflag|= SPECIAL_SAFE_MODE; opt_specialflag|= SPECIAL_SAFE_MODE;
myisam_delay_key_write=0; myisam_delay_key_write=0;
myisam_concurrent_insert=0;
myisam_recover_options= HA_RECOVER_NONE; // To be changed myisam_recover_options= HA_RECOVER_NONE; // To be changed
break; break;
case (int) OPT_SKIP_CONCURRENT_INSERT: case (int) OPT_SKIP_CONCURRENT_INSERT:

View File

@ -33,8 +33,8 @@ TABLE *unused_tables; /* Used by mysql_test */
HASH open_cache; /* Used by mysql_test */ HASH open_cache; /* Used by mysql_test */
static int open_unireg_entry(TABLE *entry,const char *db,const char *name, static int open_unireg_entry(THD *thd,TABLE *entry,const char *db,
const char *alias, bool locked); const char *name, const char *alias, bool locked);
static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name, static bool insert_fields(THD *thd,TABLE_LIST *tables, const char *table_name,
List_iterator<Item> *it); List_iterator<Item> *it);
static void free_cache_entry(TABLE *entry); static void free_cache_entry(TABLE *entry);
@ -572,7 +572,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
pthread_mutex_lock(&LOCK_open); pthread_mutex_lock(&LOCK_open);
if (open_unireg_entry(table, db, table_name, table_name,0) || if (open_unireg_entry(thd, table, db, table_name, table_name,0) ||
!(table->table_cache_key =memdup_root(&table->mem_root,(char*) key, !(table->table_cache_key =memdup_root(&table->mem_root,(char*) key,
key_length))) key_length)))
{ {
@ -706,7 +706,7 @@ TABLE *open_table(THD *thd,const char *db,const char *table_name,
/* make a new table */ /* make a new table */
if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME)))) if (!(table=(TABLE*) my_malloc(sizeof(*table),MYF(MY_WME))))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
if (open_unireg_entry(table,db,table_name,alias,0) || if (open_unireg_entry(thd, table,db,table_name,alias,0) ||
!(table->table_cache_key=memdup_root(&table->mem_root,(char*) key, !(table->table_cache_key=memdup_root(&table->mem_root,(char*) key,
key_length))) key_length)))
{ {
@ -816,7 +816,8 @@ bool reopen_table(TABLE *table,bool locked)
if (!locked) if (!locked)
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
if (open_unireg_entry(&tmp,db,table_name,table->table_name,locked)) if (open_unireg_entry(current_thd,&tmp,db,table_name,table->table_name,
locked))
goto end; goto end;
free_io_cache(table); free_io_cache(table);
@ -1110,10 +1111,11 @@ void abort_locked_tables(THD *thd,const char *db, const char *table_name)
** Purpose : Load a table definition from file and open unireg table ** Purpose : Load a table definition from file and open unireg table
** Args : entry with DB and table given ** Args : entry with DB and table given
** Returns : 0 if ok ** Returns : 0 if ok
** Note that the extra argument for open is taken from thd->open_options
*/ */
static int open_unireg_entry(TABLE *entry,const char *db,const char *name, static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
const char *alias, bool locked) const char *name, const char *alias, bool locked)
{ {
char path[FN_REFLEN]; char path[FN_REFLEN];
int error; int error;
@ -1124,10 +1126,8 @@ static int open_unireg_entry(TABLE *entry,const char *db,const char *name,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX | (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX |
HA_TRY_READ_ONLY), HA_TRY_READ_ONLY),
READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD, READ_KEYINFO | COMPUTE_TYPES | EXTRA_RECORD,
ha_open_options, thd->open_options, entry))
entry))
{ {
THD *thd=current_thd;
if (!entry->crashed) if (!entry->crashed)
goto err; // Can't repair the table goto err; // Can't repair the table

View File

@ -96,6 +96,7 @@ THD::THD()
start_time=(time_t) 0; start_time=(time_t) 0;
last_nx_table = last_nx_db = 0; last_nx_table = last_nx_db = 0;
inactive_timeout=net_wait_timeout; inactive_timeout=net_wait_timeout;
open_options=ha_open_options;
cond_count=0; cond_count=0;
command=COM_CONNECT; command=COM_CONNECT;
set_query_id=1; set_query_id=1;

View File

@ -287,7 +287,7 @@ public:
long dbug_thread_id; long dbug_thread_id;
pthread_t real_id; pthread_t real_id;
uint current_tablenr,tmp_table,cond_count,col_access,query_length; uint current_tablenr,tmp_table,cond_count,col_access,query_length;
uint server_status; uint server_status,open_options;
char scramble[9]; char scramble[9];
bool set_query_id,locked,count_cuted_fields,some_tables_deleted; bool set_query_id,locked,count_cuted_fields,some_tables_deleted;
bool no_errors, allow_sum_func, password, fatal_error; bool no_errors, allow_sum_func, password, fatal_error;
@ -300,6 +300,7 @@ public:
bool store_globals(); bool store_globals();
inline time_t query_start() { query_start_used=1; return start_time; } inline time_t query_start() { query_start_used=1; return start_time; }
inline void set_time() { if (!user_time) time_after_lock=time(&start_time); } inline void set_time() { if (!user_time) time_after_lock=time(&start_time); }
inline void end_time() { time(&start_time); }
inline void set_time(time_t t) { time_after_lock=start_time=t; user_time=1; } inline void set_time(time_t t) { time_after_lock=start_time=t; user_time=1; }
inline void lock_time() { time(&time_after_lock); } inline void lock_time() { time(&time_after_lock); }
inline void insert_id(ulonglong id) inline void insert_id(ulonglong id)

View File

@ -807,13 +807,15 @@ bool do_command(THD *thd)
send_error(net,0); // End of memory ? send_error(net,0); // End of memory ?
time_t start_of_query=thd->start_time; time_t start_of_query=thd->start_time;
thd->set_time(); thd->end_time(); // Set start time
/* If not reading from backup and if the query took too long */ /* If not reading from backup and if the query took too long */
if (!thd->user_time && if (!thd->user_time)
(ulong) (thd->start_time - start_of_query) > long_query_time)
{ {
long_query_count++; if ((ulong) (thd->start_time - thd->time_after_lock) > long_query_time)
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query); {
long_query_count++;
mysql_slow_log.write(thd, thd->query, thd->query_length, start_of_query);
}
} }
VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list
thd->proc_info=0; thd->proc_info=0;

View File

@ -131,7 +131,7 @@ void mysql_binlog_send(THD* thd, char* log_ident, ulong pos, ushort flags)
goto err; goto err;
} }
if(my_fread(log, magic, sizeof(magic), MYF(MY_NABP|MY_WME))) if(my_fread(log, (byte*) magic, sizeof(magic), MYF(MY_NABP|MY_WME)))
{ {
errmsg = "I/O error reading binlog magic number"; errmsg = "I/O error reading binlog magic number";
goto err; goto err;
@ -321,7 +321,7 @@ sweepstakes if you report the bug";
} }
//check the magic //check the magic
if(my_fread(log, magic, sizeof(magic), MYF(MY_NABP|MY_WME))) if(my_fread(log, (byte*) magic, sizeof(magic), MYF(MY_NABP|MY_WME)))
{ {
errmsg = "I/O error reading binlog magic number"; errmsg = "I/O error reading binlog magic number";
goto err; goto err;

View File

@ -399,6 +399,11 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
} }
if (join.const_tables && !thd->locked_tables) if (join.const_tables && !thd->locked_tables)
mysql_unlock_some_tables(thd, join.table,join.const_tables); mysql_unlock_some_tables(thd, join.table,join.const_tables);
if (!conds && join.outer_join)
{
/* Handle the case where we have an OUTER JOIN without a WHERE */
conds=new Item_int((longlong) 1,1); // Always true
}
select=make_select(*join.table, join.const_table_map, select=make_select(*join.table, join.const_table_map,
join.const_table_map,conds,&error); join.const_table_map,conds,&error);
if (error) if (error)
@ -856,6 +861,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
} }
} }
stat_vector[i]=0; stat_vector[i]=0;
join->outer_join=outer_join;
/* /*
** If outer join: Re-arrange tables in stat_vector so that outer join ** If outer join: Re-arrange tables in stat_vector so that outer join
@ -1553,12 +1559,14 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
double best,best_time,records; double best,best_time,records;
best=best_time=records=DBL_MAX; best=best_time=records=DBL_MAX;
KEYUSE *best_key=0; KEYUSE *best_key=0;
uint best_max_key_part=0;
if (s->keyuse) if (s->keyuse)
{ /* Use key if possible */ { /* Use key if possible */
TABLE *table=s->table; TABLE *table=s->table;
KEYUSE *keyuse,*start_key=0; KEYUSE *keyuse,*start_key=0;
double best_records=DBL_MAX; double best_records=DBL_MAX;
uint max_key_part=0;
/* Test how we can use keys */ /* Test how we can use keys */
rec= s->records/MATCHING_ROWS_IN_OTHER_TABLE; /* Assumed records/key */ rec= s->records/MATCHING_ROWS_IN_OTHER_TABLE; /* Assumed records/key */
@ -1576,34 +1584,34 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
uint keypart=keyuse->keypart; uint keypart=keyuse->keypart;
do do
{ {
if(!ft_key) if (!ft_key)
{ {
table_map map; table_map map;
if (!(rest_tables & keyuse->used_tables)) if (!(rest_tables & keyuse->used_tables))
{
found_part|= (key_part_map) 1 << keypart;
found_ref|= keyuse->used_tables;
}
/*
** If we find a ref, assume this table matches a proportional
** part of this table.
** For example 100 records matching this table with 5000 records
** gives 5000/100 = 50 records per key
** Constant tables are ignored and to avoid bad matches,
** we don't make rec less than 100.
*/
if (keyuse->used_tables &
(map=(keyuse->used_tables & ~join->const_table_map)))
{
uint tablenr;
for (tablenr=0 ; ! (map & 1) ; map>>=1, tablenr++) ;
if (map == 1) // Only one table
{ {
TABLE *tmp_table=join->all_tables[tablenr]; found_part|= (key_part_map) 1 << keypart;
if (rec > tmp_table->file->records && rec > 100) found_ref|= keyuse->used_tables;
rec=max(tmp_table->file->records,100); }
/*
** If we find a ref, assume this table matches a proportional
** part of this table.
** For example 100 records matching a table with 5000 records
** gives 5000/100 = 50 records per key
** Constant tables are ignored and to avoid bad matches,
** we don't make rec less than 100.
*/
if (keyuse->used_tables &
(map=(keyuse->used_tables & ~join->const_table_map)))
{
uint tablenr;
for (tablenr=0 ; ! (map & 1) ; map>>=1, tablenr++) ;
if (map == 1) // Only one table
{
TABLE *tmp_table=join->all_tables[tablenr];
if (rec > tmp_table->file->records && rec > 100)
rec=max(tmp_table->file->records,100);
}
} }
}
} }
keyuse++; keyuse++;
} while (keyuse->table == table && keyuse->key == key && } while (keyuse->table == table && keyuse->key == key &&
@ -1637,6 +1645,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
*/ */
if (found_part == PREV_BITS(uint,keyinfo->key_parts)) if (found_part == PREV_BITS(uint,keyinfo->key_parts))
{ /* use eq key */ { /* use eq key */
max_key_part= (uint) ~0;
if ((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME) if ((keyinfo->flags & (HA_NOSAME | HA_NULL_PART_KEY)) == HA_NOSAME)
{ {
tmp=prev_record_reads(join,found_ref); tmp=prev_record_reads(join,found_ref);
@ -1686,7 +1695,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
if ((found_part & 1) && if ((found_part & 1) &&
!(table->file->option_flag() & HA_ONLY_WHOLE_INDEX)) !(table->file->option_flag() & HA_ONLY_WHOLE_INDEX))
{ {
uint max_key_part=max_part_bit(found_part); max_key_part=max_part_bit(found_part);
/* Check if quick_range could determinate how many rows we /* Check if quick_range could determinate how many rows we
will match */ will match */
@ -1754,11 +1763,19 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
best=tmp; best=tmp;
best_records=records; best_records=records;
best_key=start_key; best_key=start_key;
best_max_key_part=max_key_part;
} }
} }
records=best_records; records=best_records;
} }
if (records >= s->found_records || best > s->read_time)
/*
Don't test table scan if it can't be better.
Prefer key lookup if we would use the same key for scanning.
*/
if ((records >= s->found_records || best > s->read_time) &&
!(s->quick && best_key && s->quick->index == best_key->key &&
best_max_key_part >= s->table->quick_key_parts[best_key->key]))
{ // Check full join { // Check full join
if (s->on_expr) if (s->on_expr)
{ {
@ -1775,6 +1792,10 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
(tmp + record_count/(double) TIME_FOR_COMPARE*s->found_records < (tmp + record_count/(double) TIME_FOR_COMPARE*s->found_records <
best + record_count/(double) TIME_FOR_COMPARE*records)) best + record_count/(double) TIME_FOR_COMPARE*records))
{ {
/*
If the table has a range (s->quick is set) make_join_select()
will ensure that this will be used
*/
best=tmp; best=tmp;
records=s->found_records; records=s->found_records;
best_key=0; best_key=0;
@ -2193,6 +2214,14 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
table_map current_map= tab->table->map; table_map current_map= tab->table->map;
used_tables|=current_map; used_tables|=current_map;
COND *tmp=make_cond_for_table(cond,used_tables,current_map); COND *tmp=make_cond_for_table(cond,used_tables,current_map);
if (!tmp && tab->quick)
{ // Outer join
/*
Hack to handle the case where we only refer to a table
in the ON part of an OUTER JOIN.
*/
tmp=new Item_int((longlong) 1,1); // Always true
}
if (tmp) if (tmp)
{ {
DBUG_EXECUTE("where",print_where(tmp,tab->table->table_name);); DBUG_EXECUTE("where",print_where(tmp,tab->table->table_name););
@ -2204,6 +2233,8 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
sel->head=tab->table; sel->head=tab->table;
if (tab->quick) if (tab->quick)
{ {
/* Use quick key read if it's a constant and it's not used
with key reading */
if (tab->needed_reg == 0 && tab->type != JT_EQ_REF && if (tab->needed_reg == 0 && tab->type != JT_EQ_REF &&
(tab->type != JT_REF || (tab->type != JT_REF ||
(uint) tab->ref.key == tab->quick->index)) (uint) tab->ref.key == tab->quick->index))
@ -2231,19 +2262,23 @@ make_join_select(JOIN *join,SQL_SELECT *select,COND *cond)
DBUG_RETURN(1); // Impossible range DBUG_RETURN(1); // Impossible range
/* /*
We plan to scan all rows. We plan to scan all rows.
Check again if we should use an index instead if Check again if we should use an index.
we could have used an column from a previous table in We could have used an column from a previous table in
the index or if we are using limit and this is the first table the index if we are using limit and this is the first table
*/ */
if ((tab->keys & ~ tab->const_keys && i > 0) || if ((tab->keys & ~ tab->const_keys && i > 0) ||
tab->const_keys && i == join->const_tables && tab->const_keys && i == join->const_tables &&
join->thd->select_limit < join->best_positions[i].records_read) join->thd->select_limit < join->best_positions[i].records_read)
{ {
/* Join with outer join condition */
COND *orig_cond=sel->cond;
sel->cond=and_conds(sel->cond,tab->on_expr);
if (sel->test_quick_select(tab->keys, if (sel->test_quick_select(tab->keys,
used_tables & ~ current_map, used_tables & ~ current_map,
join->thd->select_limit) < 0) join->thd->select_limit) < 0)
DBUG_RETURN(1); // Impossible range DBUG_RETURN(1); // Impossible range
sel->cond=orig_cond;
} }
else else
{ {

View File

@ -147,7 +147,7 @@ class JOIN {
uint tables,const_tables; uint tables,const_tables;
uint send_group_parts; uint send_group_parts;
bool sort_and_group,first_record,full_join,group, no_field_update; bool sort_and_group,first_record,full_join,group, no_field_update;
table_map const_table_map; table_map const_table_map,outer_join;
ha_rows send_records,found_records; ha_rows send_records,found_records;
POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1]; POSITION positions[MAX_TABLES+1],best_positions[MAX_TABLES+1];
double best_read; double best_read;

View File

@ -620,7 +620,10 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
Field *field=create_tmp_field(&tmp_table,item,item->type(), Field *field=create_tmp_field(&tmp_table,item,item->type(),
(Item_result_field***) 0, &tmp_field,0,0); (Item_result_field***) 0, &tmp_field,0,0);
if (!field || !(cr_field=new create_field(field,1))) if (!field ||
!(cr_field=new create_field(field,(item->type() == Item::FIELD_ITEM ?
((Item_field *)item)->field : NULL)
)))
DBUG_RETURN(0); DBUG_RETURN(0);
extra_fields->push_back(cr_field); extra_fields->push_back(cr_field);
} }
@ -833,9 +836,13 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
{ {
char table_name[NAME_LEN*2+2]; char table_name[NAME_LEN*2+2];
char* db = (table->db) ? table->db : thd->db; char* db = (table->db) ? table->db : thd->db;
bool fatal_error=0;
strxmov(table_name,db ? db : "",".",table->name,NullS); strxmov(table_name,db ? db : "",".",table->name,NullS);
if (operator_func == &handler::repair || operator_func == &handler::check)
thd->open_options|= HA_OPEN_FOR_REPAIR;
table->table = open_ltable(thd, table, lock_type); table->table = open_ltable(thd, table, lock_type);
thd->open_options&= ~HA_OPEN_FOR_REPAIR;
packet->length(0); packet->length(0);
if (operator_func == &handler::restore) if (operator_func == &handler::restore)
{ {
@ -909,6 +916,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
case HA_ADMIN_CORRUPT: case HA_ADMIN_CORRUPT:
net_store_data(packet, "error"); net_store_data(packet, "error");
net_store_data(packet, "Corrupt"); net_store_data(packet, "Corrupt");
fatal_error=1;
break; break;
case HA_ADMIN_INVALID: case HA_ADMIN_INVALID:
@ -919,8 +927,11 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
default: // Probably HA_ADMIN_INTERNAL_ERROR default: // Probably HA_ADMIN_INTERNAL_ERROR
net_store_data(packet, "error"); net_store_data(packet, "error");
net_store_data(packet, "Unknown - internal error during operation"); net_store_data(packet, "Unknown - internal error during operation");
fatal_error=1;
break; break;
} }
if (fatal_error)
table->table->flush_version=0; // Force close of table
close_thread_tables(thd); close_thread_tables(thd);
if (my_net_write(&thd->net, (char*) packet->ptr(), if (my_net_write(&thd->net, (char*) packet->ptr(),
packet->length())) packet->length()))
@ -1150,7 +1161,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
} }
else else
{ // Use old field value { // Use old field value
create_list.push_back(def=new create_field(field)); create_list.push_back(def=new create_field(field,field));
if (def->sql_type == FIELD_TYPE_TIMESTAMP) if (def->sql_type == FIELD_TYPE_TIMESTAMP)
use_timestamp=1; use_timestamp=1;

View File

@ -510,7 +510,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
flush_options flush_option insert_lock_option replace_lock_option flush_options flush_option insert_lock_option replace_lock_option
equal optional_braces opt_key_definition key_usage_list2 equal optional_braces opt_key_definition key_usage_list2
opt_mi_check_type opt_to mi_check_types normal_join opt_mi_check_type opt_to mi_check_types normal_join
table_to_table_list table_to_table opt_table_list table_to_table_list table_to_table opt_table_list opt_as
END_OF_INPUT END_OF_INPUT
%type <NONE> %type <NONE>
@ -674,13 +674,17 @@ create2:
| opt_create_table_options create3 {} | opt_create_table_options create3 {}
create3: create3:
/* empty*/ {} /* empty */ {}
| opt_duplicate SELECT_SYM | opt_duplicate opt_as SELECT_SYM
{ {
mysql_init_select(Lex); mysql_init_select(Lex);
} }
select_options select_item_list opt_select_from {} select_options select_item_list opt_select_from {}
opt_as:
/* empty */ {}
| AS {}
opt_table_options: opt_table_options:
/* empty */ { $$= 0; } /* empty */ { $$= 0; }
| table_options { $$= $1;} | table_options { $$= $1;}