diff options
Diffstat (limited to 'sql-bench')
-rw-r--r-- | sql-bench/bench-init.pl.sh | 13 | ||||
-rw-r--r-- | sql-bench/compare-results.sh | 2 | ||||
-rw-r--r-- | sql-bench/crash-me.sh | 45 | ||||
-rw-r--r-- | sql-bench/example | 9 | ||||
-rwxr-xr-x | sql-bench/graph-compare-results.sh | 3 | ||||
-rw-r--r-- | sql-bench/limits/mysql.cfg | 27 | ||||
-rwxr-xr-x | sql-bench/myisam.cnf | 3 | ||||
-rw-r--r-- | sql-bench/server-cfg.sh | 49 | ||||
-rw-r--r-- | sql-bench/test-ATIS.sh | 2 | ||||
-rw-r--r-- | sql-bench/test-alter-table.sh | 2 | ||||
-rw-r--r-- | sql-bench/test-big-tables.sh | 2 | ||||
-rw-r--r-- | sql-bench/test-connect.sh | 45 | ||||
-rw-r--r-- | sql-bench/test-create.sh | 14 | ||||
-rw-r--r-- | sql-bench/test-select.sh | 29 | ||||
-rwxr-xr-x | sql-bench/test-table-elimination.sh | 318 | ||||
-rw-r--r-- | sql-bench/test-transactions.sh | 4 | ||||
-rw-r--r-- | sql-bench/test-wisconsin.sh | 2 |
17 files changed, 495 insertions, 74 deletions
diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh index 2d767fc5f78..a46bb2d7a49 100644 --- a/sql-bench/bench-init.pl.sh +++ b/sql-bench/bench-init.pl.sh @@ -40,8 +40,8 @@ require "$pwd/server-cfg" || die "Can't read Configuration file: $!\n"; $|=1; # Output data immediately -$opt_skip_test=$opt_skip_create=$opt_skip_delete=$opt_verbose=$opt_fast_insert=$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=$opt_log=$opt_use_old_results=$opt_help=$opt_odbc=$opt_small_test=$opt_small_tables=$opt_samll_key_tables=$opt_stage=$opt_old_headers=$opt_die_on_errors=$opt_tcpip=$opt_random=$opt_only_missing_tests=0; -$opt_cmp=$opt_user=$opt_password=$opt_connect_options=""; +$opt_skip_test=$opt_skip_create=$opt_skip_delete=$opt_verbose=$opt_fast_insert=$opt_lock_tables=$opt_debug=$opt_skip_delete=$opt_fast=$opt_force=$opt_log=$opt_use_old_results=$opt_help=$opt_odbc=$opt_small_test=$opt_small_tables=$opt_samll_key_tables=$opt_stage=$opt_old_headers=$opt_die_on_errors=$opt_tcpip=$opt_random=$opt_only_missing_tests=$opt_temporary_tables=0; +$opt_cmp=$opt_user=$opt_password=$opt_connect_options=$opt_connect_command= ""; $opt_server="mysql"; $opt_dir="output"; $opt_host="localhost";$opt_database="test"; $opt_machine=""; $opt_suffix=""; @@ -60,7 +60,7 @@ $log_prog_args=join(" ", skip_arguments(\@ARGV,"comments","cmp","server", "use-old-results","skip-test", "optimization","hw", "machine", "dir", "suffix", "log")); -GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s","only-missing-tests") || usage(); +GetOptions("skip-test=s","comments=s","cmp=s","server=s","user=s","host=s","database=s","password=s","loop-count=i","row-count=i","skip-create","skip-delete","verbose","fast-insert","lock-tables","debug","fast","force","field-count=i","regions=i","groups=i","time-limit=i","log","use-old-results","machine=s","dir=s","suffix=s","help","odbc","small-test","small-tables","small-key-tables","stage=i","threads=i","random","old-headers","die-on-errors","create-options=s","hires","tcpip","silent","optimization=s","hw=s","socket=s","connect-options=s","connect-command=s","only-missing-tests","temporary-tables") || usage(); usage() if ($opt_help); $server=get_server($opt_server,$opt_host,$opt_database,$opt_odbc, @@ -455,6 +455,9 @@ All benchmarks takes the following options: create all MySQL tables as InnoDB tables use: --create-options=ENGINE=InnoDB +--temporary-tables + Use temporary tables for all tests. + --database (Default $opt_database) In which database the test tables are created. @@ -596,6 +599,10 @@ All benchmarks takes the following options: Add options, which uses at DBI connect. For example --connect-options=mysql_read_default_file=/etc/my.cnf. +--connect-command='SQL command' + Initialization command to execute when logged in. Useful for setting + up the environment. + EOF exit(0); } diff --git a/sql-bench/compare-results.sh b/sql-bench/compare-results.sh index a70f82422f4..91d29685ee3 100644 --- a/sql-bench/compare-results.sh +++ b/sql-bench/compare-results.sh @@ -513,7 +513,7 @@ sub print_value else { $first=1 if ($first == 0); # Assume that it took one second instead of 0 - $tmp= sprintf("%.2f",$value/$first); + $tmp= sprintf("%.3f",$value/$first); } if (defined($flags)) { diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh index 473a66933cc..4391a2afb40 100644 --- a/sql-bench/crash-me.sh +++ b/sql-bench/crash-me.sh @@ -40,7 +40,7 @@ # as such, and clarify ones such as "mediumint" with comments such as # "3-byte int" or "same as xxx". -$version="1.61"; +$version="1.62"; use Cwd; use DBI; @@ -620,6 +620,8 @@ check_reserved_words($dbh); "numeric(9,2)","decimal(6,2)","dec(6,2)", "bit", "bit(2)","bit varying(2)","float","float(8)","real", "double precision", "date","time","timestamp", + "time(6)", "timestamp(6)", + "datetime", "datetime(6)", "interval year", "interval year to month", "interval month", "interval day", "interval day to hour", "interval day to minute", @@ -633,8 +635,7 @@ check_reserved_words($dbh); "national char varying(20)","nchar varying(20)", "national character varying(20)", "timestamp with time zone"); -@odbc_types=("binary(1)","varbinary(1)","tinyint","bigint", - "datetime"); +@odbc_types=("binary(1)","varbinary(1)","tinyint","bigint"); @extra_types=("blob","byte","long varbinary","image","text","text(10)", "mediumtext", "long varchar(1)", "varchar2(257)", @@ -664,7 +665,7 @@ check_reserved_words($dbh); foreach $types (@types) { print "\nSupported $types->[0] types\n"; - $tmp=@$types->[1]; + $tmp= $types->[1]; foreach $use_type (@$tmp) { $type=$use_type; @@ -747,10 +748,14 @@ if (($limits{'type_extra_float(2_arg)'} eq "yes" || $result="exact"; } $prompt="Storage of float values"; - print "$prompt: $result\n"; save_config_data("storage_of_float", $result, $prompt); } +if (defined($limits{'storage_of_float'})) +{ + print "Storage of float values: $limits{'storage_of_float'}\n"; +} + try_and_report("Type for row id", "rowid", ["rowid", "create table crash_q (a rowid)", @@ -1062,7 +1067,7 @@ try_and_report("Automatic row id", "automatic_rowid", foreach $types (@types) { print "\nSupported $types->[0] functions\n"; - $tmp=@$types->[1]; + $tmp= $types->[1]; foreach $type (@$tmp) { if (defined($limits{"func_$types->[0]_$type->[1]"})) @@ -1137,7 +1142,7 @@ if ($limits{'functions'} eq 'yes') foreach $types (@group_types) { print "\nSupported $types->[0] group functions\n"; - $tmp=@$types->[1]; + $tmp= $types->[1]; foreach $type (@$tmp) { check_and_report("Group function $type->[0]", @@ -3133,8 +3138,11 @@ $0 takes the following options: Wait this long before restarting server. --verbose ---noverbose Log into the result file queries performed for determination parameter value + This causes rows starting with ' ###' to be logged into the .cnf file + +--noverbose + Don't log '###' quries to the .cnf file. EOF exit(0); @@ -4350,7 +4358,7 @@ sub save_config_data my $last_line_was_empty=0; foreach $line (split /\n/, $log{$key}) { - print CONFIG_FILE " ###$line\n" + print CONFIG_FILE "$log_prefix$line\n" unless ( ($last_line_was_empty eq 1) && ($line =~ /^\s+$/) ); $last_line_was_empty= ($line =~ /^\s+$/)?1:0; @@ -4370,7 +4378,7 @@ sub add_log { my $key = shift; my $line = shift; - $log{$key} .= $line . "\n" if ($opt_verbose);; + $log{$key} .= $line . "\n" if ($opt_verbose); } sub save_all_config_data @@ -4392,14 +4400,17 @@ sub save_all_config_data $tmp="$key=$limits{$key}"; print CONFIG_FILE $tmp . ("\t" x (int((32-min(length($tmp),32)+7)/8)+1)) . "# $prompts{$key}\n"; - my $line; - my $last_line_was_empty=0; - foreach $line (split /\n/, $log{$key}) - { - print CONFIG_FILE " ###$line\n" unless - ( ($last_line_was_empty eq 1) && ($line =~ /^\s*$/)); + if ($opt_verbose) + { + my $line; + my $last_line_was_empty=0; + foreach $line (split /\n/, $log{$key}) + { + print CONFIG_FILE "$log_prefix$line\n" unless + ( ($last_line_was_empty eq 1) && ($line =~ /^\s*$/)); $last_line_was_empty= ($line =~ /^\s*$/)?1:0; - }; + } + } } close CONFIG_FILE; } diff --git a/sql-bench/example b/sql-bench/example index df2a9b8be69..877fd080ac5 100644 --- a/sql-bench/example +++ b/sql-bench/example @@ -6,15 +6,14 @@ machine="Linux-x64" # InnoDB tests -./run-all-tests --suffix=-innodb --comments="Engine=InnoDB --innodb_log_file_size=100M" --create-options="ENGINE=InnoDB" --hw="$hw" --optimization="$optimization" --machine="$machine" --log - -./run-all-tests --suffix=_fast-innodb --comments="Engine=InnoDB --innodb_log_file_size=100M" --create-options="ENGINE=InnoDB" --hw="$hw" --optimization="$optimization" --machine="$machine" --fast --log +./run-all-tests --suffix=-innodb --comments="Engine=InnoDB --innodb_buffer_pool_size=256M --innodb_additional_mem_pool_size=20M --innodb_log_file_size=1000M --innodb_log_buffer_size=16M --innodb_lock_wait_timeout=50 --innodb_flush_log_at_trx_commit=1 --innodb_flush_method=O_DIRECT --innodb_log_files_in_group=2 --skip-innodb-doublewrite" --create-options="ENGINE=InnoDB" --hw="$hw" --optimization="$optimization" --machine="$machine" --log +./run-all-tests --suffix=_fast-innodb --comments="Engine=InnoDB --innodb_buffer_pool_size=256M --innodb_additional_mem_pool_size=20M --innodb_log_file_size=1000M --innodb_log_buffer_size=16M --innodb_lock_wait_timeout=50 --innodb_flush_log_at_trx_commit=1 --innodb_flush_method=O_DIRECT --innodb_log_files_in_group=2 --skip-innodb-doublewrite" --create-options="ENGINE=InnoDB" --hw="$hw" --optimization="$optimization" --machine="$machine" --fast --log # MyISAM tests -./run-all-tests --suffix=-myisam --comments="Engine=MyISAM key_buffer_size=16M" --create-options="ENGINE=myisam" --hw="$hw" --optimization="$optimization" --machine="$machine" --log +./run-all-tests --suffix=-myisam --comments="Engine=MyISAM key_buffer_size=256M" --create-options="ENGINE=myisam" --hw="$hw" --optimization="$optimization" --machine="$machine" --log -./run-all-tests --suffix=_fast-myisam --comments="Engine=MyISAM key_buffer_size=16M" --create-options="ENGINE=myisam" --hw="$hw" --optimization="$optimization" --machine="$machine" --fast --log +./run-all-tests --suffix=_fast-myisam --comments="Engine=MyISAM key_buffer_size=256M" --create-options="ENGINE=myisam" --hw="$hw" --optimization="$optimization" --machine="$machine" --fast --log compare-results --relative output/RUN-mysql-myisam-* output/RUN-mysql_fast-myisam* output/RUN-mysql* diff --git a/sql-bench/graph-compare-results.sh b/sql-bench/graph-compare-results.sh index c5ba68655cc..ddc9080acd6 100755 --- a/sql-bench/graph-compare-results.sh +++ b/sql-bench/graph-compare-results.sh @@ -1,5 +1,4 @@ -#! /usr/bin/perl - +#!/usr/bin/perl #### #### Hello ... this is a heavily hacked script by Luuk #### instead of printing the result it makes a nice gif diff --git a/sql-bench/limits/mysql.cfg b/sql-bench/limits/mysql.cfg index 76565cb16ff..1194898481d 100644 --- a/sql-bench/limits/mysql.cfg +++ b/sql-bench/limits/mysql.cfg @@ -1,4 +1,4 @@ -#This file is automaticly generated by crash-me 1.61 +#This file is automaticly generated by crash-me 1.62 NEG=yes # update of column= -column Need_cast_for_null=no # Need to cast NULL for arithmetic @@ -31,7 +31,7 @@ comment_--=yes # -- as comment (ANSI) comment_/**/=yes # /* */ as comment comment_//=no # // as comment compute=no # Compute -connections=101 # Simultaneous connections (installation default) +connections=152 # Simultaneous connections (installation default) constraint_check=syntax only # Column constraints constraint_check_named=syntax only # Named constraints constraint_check_table=syntax only # Table constraints @@ -387,17 +387,17 @@ max_char_size=255 # max char() size max_column_name=64 # column name length max_columns=2599 # Columns in table max_conditions=85660 # OR and AND in WHERE -max_expressions=580 # simple expressions +max_expressions=571 # simple expressions max_index=+64 # max index max_index_length=1000 # index length max_index_name=64 # index name length max_index_part_length=255 # max index part length -max_index_parts=16 # index parts +max_index_parts=32 # index parts max_index_varchar_part_length=1000 # index varchar part length max_row_length=65534 # max table row length (without blobs) max_row_length_with_null=65502 # table row length with nulls (without blobs) max_select_alias_name=+512 # select alias name length -max_stack_expression=580 # stacked expressions +max_stack_expression=571 # stacked expressions max_table_alias_name=+512 # table alias name length max_table_name=64 # table name length max_text_size=1048543 # max text or blob size @@ -422,7 +422,7 @@ null_in_unique=yes # null in unique index null_num_expr=yes # Is 1+NULL = NULL nulls_in_unique=yes # null combination in unique index odbc_left_outer_join=yes # left outer join odbc style -operating_system=Linux 2.6.8-my i686 # crash-me tested on +operating_system=Linux 2.6.37.6-0.7-desktop x86_64 # crash-me tested on order_by=yes # Order by order_by_alias=yes # Order by alias order_by_function=yes # Order by function @@ -433,7 +433,7 @@ position_of_null_desc=last # Where is null values in sorted recordset (DESC) primary_key_in_create=yes # primary key in create table psm_functions=no # PSM functions (ANSI SQL) psm_modules=no # PSM modules (ANSI SQL) -psm_procedures=no # PSM procedures (ANSI SQL) +psm_procedures=yes # PSM procedures (ANSI SQL) psm_trigger=no # Triggers (ANSI SQL) query_size=1048574 # query size quote_ident_with_"=error # " as identifier quote (ANSI SQL) @@ -485,7 +485,7 @@ reserved_word_ansi-92/99_column=yes # Keyword COLUMN reserved_word_ansi-92/99_commit=no # Keyword COMMIT reserved_word_ansi-92/99_completion=no # Keyword COMPLETION reserved_word_ansi-92/99_connect=no # Keyword CONNECT -reserved_word_ansi-92/99_connection=yes # Keyword CONNECTION +reserved_word_ansi-92/99_connection=no # Keyword CONNECTION reserved_word_ansi-92/99_constraint=yes # Keyword CONSTRAINT reserved_word_ansi-92/99_constraints=no # Keyword CONSTRAINTS reserved_word_ansi-92/99_continue=yes # Keyword CONTINUE @@ -546,7 +546,7 @@ reserved_word_ansi-92/99_general=no # Keyword GENERAL reserved_word_ansi-92/99_get=no # Keyword GET reserved_word_ansi-92/99_global=no # Keyword GLOBAL reserved_word_ansi-92/99_go=no # Keyword GO -reserved_word_ansi-92/99_goto=yes # Keyword GOTO +reserved_word_ansi-92/99_goto=no # Keyword GOTO reserved_word_ansi-92/99_grant=yes # Keyword GRANT reserved_word_ansi-92/99_group=yes # Keyword GROUP reserved_word_ansi-92/99_having=yes # Keyword HAVING @@ -933,7 +933,7 @@ reserved_word_extra_setuser=no # Keyword SETUSER reserved_word_extra_share=no # Keyword SHARE reserved_word_extra_show=yes # Keyword SHOW reserved_word_extra_shutdown=no # Keyword SHUTDOWN -reserved_word_extra_soname=yes # Keyword SONAME +reserved_word_extra_soname=no # Keyword SONAME reserved_word_extra_spatial=yes # Keyword SPATIAL reserved_word_extra_sql_big_result=yes # Keyword SQL_BIG_RESULT reserved_word_extra_sql_calc_found_rows=yes # Keyword SQL_CALC_FOUND_ROWS @@ -983,7 +983,7 @@ select_limit3=yes # SELECT with LIMIT # OFFSET # select_string_size=1048565 # constant string size in SELECT select_table_update=yes # Update with sub select select_without_from=yes # SELECT without FROM -server_version=MySQL 5.0.7 beta valgrind max debug/ # server version +server_version=MySQL 5.3.1 MariaDB beta valgrind max debug # server version simple_joins=yes # ANSI SQL simple joins sorted_group_by=yes # Group by always sorted storage_of_float=round # Storage of float values @@ -1063,7 +1063,6 @@ type_extra_varchar2(1_arg)=no # Type varchar2(1 arg) type_extra_year=yes # Type year type_odbc_bigint=yes # Type bigint type_odbc_binary(1_arg)=yes # Type binary(1 arg) -type_odbc_datetime=yes # Type datetime type_odbc_tinyint=yes # Type tinyint type_odbc_varbinary(1_arg)=yes # Type varbinary(1 arg) type_sql_bit=yes # Type bit @@ -1075,6 +1074,8 @@ type_sql_char_varying(1_arg)=yes # Type char varying(1 arg) type_sql_character(1_arg)=yes # Type character(1 arg) type_sql_character_varying(1_arg)=yes # Type character varying(1 arg) type_sql_date=yes # Type date +type_sql_datetime=yes # Type datetime +type_sql_datetime(1_arg)=yes # Type datetime(1 arg) type_sql_dec(2_arg)=yes # Type dec(2 arg) type_sql_decimal(2_arg)=yes # Type decimal(2 arg) type_sql_double_precision=yes # Type double precision @@ -1104,7 +1105,9 @@ type_sql_numeric(2_arg)=yes # Type numeric(2 arg) type_sql_real=yes # Type real type_sql_smallint=yes # Type smallint type_sql_time=yes # Type time +type_sql_time(1_arg)=yes # Type time(1 arg) type_sql_timestamp=yes # Type timestamp +type_sql_timestamp(1_arg)=yes # Type timestamp(1 arg) type_sql_timestamp_with_time_zone=no # Type timestamp with time zone type_sql_varchar(1_arg)=yes # Type varchar(1 arg) union=yes # union diff --git a/sql-bench/myisam.cnf b/sql-bench/myisam.cnf new file mode 100755 index 00000000000..4229f56cefb --- /dev/null +++ b/sql-bench/myisam.cnf @@ -0,0 +1,3 @@ +[mysqld] +data=/data +key_buffer_size=256M diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 9137e57bfe1..4cc39481523 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -160,6 +160,7 @@ sub new $limits{'max_index'} = 16; # Max number of keys $limits{'max_index_parts'} = 16; # Max segments/key $limits{'max_tables'} = (($machine || '') =~ "^win") ? 5000 : 65000; + $limits{'max_temporary_tables'}= 400; $limits{'max_text_size'} = 1000000; # Good enough for tests $limits{'multi_drop'} = 1; # Drop table can take many tables $limits{'order_by_position'} = 1; # Can use 'ORDER BY 1' @@ -179,6 +180,12 @@ sub new { $limits{'working_blobs'} = 0; # HEAP tables can't handle BLOB's } + # HEAP is deprecated in favor of MEMORY + if (defined($main::opt_create_options) && + $main::opt_create_options =~ /engine=memory/i) + { + $limits{'working_blobs'} = 0; # MEMORY tables can't handle BLOB's + } if (defined($main::opt_create_options) && $main::opt_create_options =~ /engine=innodb/i) { @@ -190,6 +197,7 @@ sub new $self->{'transactions'} = 1; # Transactions enabled $limits{'max_columns'} = 90; # Max number of columns in table $limits{'max_tables'} = 32; # No comments + $limits{'max_temporary_tables'}= $limits{"max_tables"}; } if (defined($main::opt_create_options) && $main::opt_create_options =~ /engine=bdb/i) @@ -201,6 +209,7 @@ sub new { $limits{'working_blobs'} = 0; # Blobs not implemented yet $limits{'max_tables'} = 500; + $limits{'max_temporary_tables'}= $limits{"max_tables"}; $self->{'transactions'} = 1; # Transactions enabled } @@ -250,6 +259,11 @@ sub connect die "Got error: '$DBI::errstr' when connecting to " . $self->{'data_source'} ." with user: '$main::opt_user' password: '$main::opt_password'\n"; $dbh->do("SET OPTION LOG_OFF=1,UPDATE_LOG=0"); + if ($main::opt_connect_command ne "") + { + $dbh->do($main::opt_connect_command) or + die "Can't execute connect_command: $main::opt_connect_command error: $DBI::errstr\n"; + } return $dbh; } @@ -266,7 +280,14 @@ sub create my($self,$table_name,$fields,$index,$options) = @_; my($query,@queries); - $query="create table $table_name ("; + if ($main::opt_temporary_tables) + { + $query="create temporary table $table_name ("; + } + else + { + $query="create table $table_name ("; + } foreach $field (@$fields) { # $field =~ s/ decimal/ double(10,2)/i; @@ -389,6 +410,7 @@ sub new $limits{'max_conditions'} = 74; $limits{'max_columns'} = 75; $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; $limits{'max_text_size'} = 32000; $limits{'query_size'} = 65535; $limits{'max_index'} = 5; @@ -618,7 +640,9 @@ sub new $limits{'max_conditions'} = 9999; # This makes Pg real slow $limits{'max_index'} = 64; # Big enough $limits{'max_index_parts'} = 16; - $limits{'max_tables'} = 5000; # 10000 crashes pg 7.0.2 + $limits{'max_tables'} = 65000; + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 65000; # Good enough for test $limits{'multi_drop'} = 1; $limits{'order_by_position'} = 1; @@ -869,6 +893,8 @@ sub new $limits{'max_conditions'} = 9999; # Probably big enough $limits{'max_columns'} = 2000; # From crash-me $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 65492; # According to tests $limits{'query_size'} = 65535; # Probably a limit $limits{'max_index'} = 64; # Probably big enough @@ -1100,6 +1126,7 @@ sub new # above this value .... but can handle 2419 columns # maybe something for crash-me ... but how to check ??? $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; $limits{'max_text_size'} = 4095; # max returned .... $limits{'query_size'} = 65535; # Not a limit, big enough $limits{'max_index'} = 64; # Big enough @@ -1370,6 +1397,8 @@ sub new $limits{'max_conditions'} = 9999; # (Actually not a limit) $limits{'max_columns'} = 254; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 2000; # Limit for blob test-connect $limits{'query_size'} = 65525; # Max size with default buffers. $limits{'max_index'} = 16; # Max number of keys @@ -1643,6 +1672,8 @@ sub new $limits{'max_column_name'} = 18; # max table and column name $limits{'max_columns'} = 994; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_index'} = 64; # Max number of keys $limits{'max_index_parts'} = 15; # Max segments/key $limits{'max_text_size'} = 65535; # Max size with default buffers. ?? @@ -1831,6 +1862,8 @@ sub new $limits{'max_conditions'} = 97; # We get 'Query is too complex' $limits{'max_columns'} = 255; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 255; # Max size with default buffers. $limits{'query_size'} = 65535; # Not a limit, big enough $limits{'max_index'} = 32; # Max number of keys @@ -2016,6 +2049,8 @@ sub new $limits{'max_conditions'} = 1030; # We get 'Query is too complex' $limits{'max_columns'} = 250; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 9830; # Max size with default buffers. $limits{'query_size'} = 9830; # Max size with default buffers. $limits{'max_index'} = 64; # Max number of keys @@ -2212,6 +2247,8 @@ sub new $limits{'max_conditions'} = 1030; # We get 'Query is too complex' $limits{'max_columns'} = 250; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 9830; # Max size with default buffers. $limits{'query_size'} = 9830; # Max size with default buffers. $limits{'max_index'} = 64; # Max number of keys @@ -2444,6 +2481,8 @@ sub new $limits{'max_conditions'} = 50; # (Actually not a limit) $limits{'max_columns'} = 254; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 2000; # Limit for blob test-connect $limits{'query_size'} = 65525; # Max size with default buffers. $limits{'max_index'} = 16; # Max number of keys @@ -2648,6 +2687,8 @@ sub new $limits{'max_conditions'} = 418; # We get 'Query is too complex' $limits{'max_columns'} = 500; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; + $limits{'max_text_size'} = 254; # Max size with default buffers. $limits{'query_size'} = 254; # Max size with default buffers. $limits{'max_index'} = 48; # Max number of keys @@ -2826,6 +2867,7 @@ sub new $limits{'max_conditions'} = 9999; # (Actually not a limit) $limits{'max_columns'} = 252; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; $limits{'max_text_size'} = 15000; # Max size with default buffers. $limits{'query_size'} = 1000000; # Max size with default buffers. $limits{'max_index'} = 32; # Max number of keys @@ -3028,6 +3070,7 @@ sub new $limits{'max_conditions'} = 9999; # (Actually not a limit) $limits{'max_columns'} = 252; # Max number of columns in table $limits{'max_tables'} = 65000; # Should be big enough + $limits{'max_temporary_tables'}= $limits{"max_tables"}; $limits{'max_text_size'} = 15000; # Max size with default buffers. $limits{'query_size'} = 1000000; # Max size with default buffers. $limits{'max_index'} = 65000; # Max number of keys @@ -3224,6 +3267,7 @@ sub new # The following should be 8192, but is smaller because Frontbase crashes.. $limits{'max_columns'} = 150; # Max number of columns in table $limits{'max_tables'} = 5000; # 10000 crashed FrontBase + $limits{'max_temporary_tables'}= $limits{"max_tables"}; $limits{'max_text_size'} = 65000; # Max size with default buffers. $limits{'query_size'} = 8000000; # Max size with default buffers. $limits{'max_index'} = 38; # Max number of keys @@ -3436,6 +3480,7 @@ sub new $limits{'max_conditions'} = 9999; # (Actually not a limit) * $limits{'max_columns'} = 1023; # Max number of columns in table * $limits{'max_tables'} = 65000; # Should be big enough * unlimited actually + $limits{'max_temporary_tables'}= $limits{"max_tables"}; $limits{'max_text_size'} = 15000; # Max size with default buffers. $limits{'query_size'} = 64*1024; # Max size with default buffers. *64 kb by default. May be set by system variable $limits{'max_index'} = 510; # Max number of keys * diff --git a/sql-bench/test-ATIS.sh b/sql-bench/test-ATIS.sh index dc6bf28e183..ca1132435ff 100644 --- a/sql-bench/test-ATIS.sh +++ b/sql-bench/test-ATIS.sh @@ -29,7 +29,7 @@ use Cwd; use DBI; use Benchmark; -$opt_loop_count=100; # Run selects this many times +$opt_loop_count=5000; # Run selects this many times $pwd = cwd(); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; diff --git a/sql-bench/test-alter-table.sh b/sql-bench/test-alter-table.sh index a724e5cfc08..6dc5ce35841 100644 --- a/sql-bench/test-alter-table.sh +++ b/sql-bench/test-alter-table.sh @@ -26,7 +26,7 @@ use DBI; use Benchmark; $opt_start_field_count=8; # start with this many fields -$opt_loop_count=100; # How many tests to do +$opt_loop_count=10000; # How many tests to do $opt_row_count=1000; # Rows in the table $opt_field_count=1000; # Add until this many fields. $opt_time_limit=10*60; # Don't wait more than 10 min for some tests diff --git a/sql-bench/test-big-tables.sh b/sql-bench/test-big-tables.sh index 67c87172cf0..68b4afaa429 100644 --- a/sql-bench/test-big-tables.sh +++ b/sql-bench/test-big-tables.sh @@ -26,7 +26,7 @@ use Cwd; use DBI; use Benchmark; -$opt_loop_count=1000; # Change this to make test harder/easier +$opt_loop_count=70000; # Change this to make test harder/easier $opt_field_count=1000; $pwd = cwd(); $pwd = "." if ($pwd eq ''); diff --git a/sql-bench/test-connect.sh b/sql-bench/test-connect.sh index a307d5e1014..50024e7e055 100644 --- a/sql-bench/test-connect.sh +++ b/sql-bench/test-connect.sh @@ -29,7 +29,7 @@ use Cwd; use DBI; use Benchmark; -$opt_loop_count=100000; # Change this to make test harder/easier +$opt_loop_count=500000; # Change this to make test harder/easier $str_length=65000; # This is the length of blob strings in PART:5 $max_test=20; # How many times to test if the server is busy @@ -162,41 +162,48 @@ if ($opt_fast && defined($server->{vacuum})) { $server->vacuum(0,\$dbh); } -$dbh->disconnect; +if (!$main::opt_temporary_tables) +{ + $dbh->disconnect; +} # # First test connect/select/disconnect # -print "Testing connect/select 1 row from table/disconnect\n"; +if (!$main::opt_temporary_tables) +{ + print "Testing connect/select 1 row from table/disconnect\n"; -$loop_time=new Benchmark; -$errors=0; + $loop_time=new Benchmark; + $errors=0; -for ($i=0 ; $i < $small_loop_count ; $i++) -{ - for ($j=0; $j < $max_test ; $j++) + for ($i=0 ; $i < $small_loop_count ; $i++) { - last if ($dbh = DBI->connect($server->{'data_source'}, $opt_user, $opt_password)); - $errors++; - } - die $DBI::errstr if ($j == $max_test); + for ($j=0; $j < $max_test ; $j++) + { + last if ($dbh = DBI->connect($server->{'data_source'}, $opt_user, $opt_password)); + $errors++; + } + die $DBI::errstr if ($j == $max_test); - $sth = $dbh->do("select a,i,s,$i from bench1") # Select * from table with 1 record + $sth = $dbh->do("select a,i,s,$i from bench1") # Select * from table with 1 record or die $DBI::errstr; - $dbh->disconnect; -} + $dbh->disconnect; + } -$end_time=new Benchmark; -print "Warning: $errors connections didn't work without a time delay\n" if ($errors); -print "Time to connect+select_1_row ($small_loop_count): " . + $end_time=new Benchmark; + print "Warning: $errors connections didn't work without a time delay\n" if ($errors); + print "Time to connect+select_1_row ($small_loop_count): " . timestr(timediff($end_time, $loop_time),"all") . "\n\n"; + $dbh = $server->connect(); +} + # # The same test, but without connect/disconnect # print "Testing select 1 row from table\n"; -$dbh = $server->connect(); $loop_time=new Benchmark; for ($i=0 ; $i < $opt_loop_count ; $i++) diff --git a/sql-bench/test-create.sh b/sql-bench/test-create.sh index fd9269398b2..235cacd86ec 100644 --- a/sql-bench/test-create.sh +++ b/sql-bench/test-create.sh @@ -48,7 +48,15 @@ if ($opt_small_test) $create_loop_count/=1000; } -$max_tables=min($limits->{'max_tables'},$opt_loop_count); +if ($opt_temporary_tables) +{ + $max_tables=min($limits->{'max_tables'},$opt_loop_count); +} +else +{ + $max_tables=min($limits->{'max_tables'},$opt_loop_count); + $max_tables=400; +} if ($opt_small_test) { @@ -72,7 +80,7 @@ $dbh = $server->connect(); if ($opt_force) # If tables used in this test exist, drop 'em { print "Okay..Let's make sure that our tables don't exist yet.\n\n"; - for ($i=1 ; $i <= $max_tables ; $i++) + for ($i=1 ; $i <= max($max_tables, $create_loop_count) ; $i++) { $dbh->do("drop table bench_$i" . $server->{'drop_attr'}); } @@ -246,7 +254,7 @@ for ($i=2 ; $i <= $keys ; $i++) } $loop_time=new Benchmark; -for ($i=1 ; $i <= $opt_loop_count ; $i++) +for ($i=1 ; $i <= $create_loop_count ; $i++) { do_many($dbh,$server->create("bench_$i", \@fields, \@keys)); $dbh->do("drop table bench_$i" . $server->{'drop_attr'}) or die $DBI::errstr; diff --git a/sql-bench/test-select.sh b/sql-bench/test-select.sh index 8ea205cbfb7..1752c05079b 100644 --- a/sql-bench/test-select.sh +++ b/sql-bench/test-select.sh @@ -27,7 +27,7 @@ use Getopt::Long; use Benchmark; $opt_loop_count=10000; -$opt_medium_loop_count=1000; +$opt_medium_loop_count=7000; $opt_small_loop_count=10; $opt_regions=6; $opt_groups=100; @@ -69,7 +69,8 @@ do_many($dbh,$server->create("bench1", ["region char(1) NOT NULL", "idn integer(6) NOT NULL", "rev_idn integer(6) NOT NULL", - "grp integer(6) NOT NULL"], + "grp integer(6) NOT NULL", + "grp_no_key integer(6) NOT NULL"], ["primary key (region,idn)", "unique (region,rev_idn)", "unique (region,grp,idn)"])); @@ -106,10 +107,10 @@ for ($id=0,$rev_id=$opt_loop_count-1 ; $id < $opt_loop_count ; $id++,$rev_id--) { $grp=$id*3 % $opt_groups; $region=chr(65+$id%$opt_regions); - do_query($dbh,"$query'$region',$id,$rev_id,$grp)"); + do_query($dbh,"$query'$region',$id,$rev_id,$grp,$grp)"); if ($id == $half_done) { # Test with different insert - $query="insert into bench1 (region,idn,rev_idn,grp) values ("; + $query="insert into bench1 (region,idn,rev_idn,grp,grp_no_key) values ("; } } @@ -324,6 +325,26 @@ if ($limits->{'group_functions'}) $end_time=new Benchmark; print "Time for count_group_on_key_parts ($i:$rows): " . timestr(timediff($end_time, $loop_time),"all") . "\n"; + + $loop_time=new Benchmark; + $rows=0; + for ($i=0 ; $i < $opt_medium_loop_count ; $i++) + { + $rows+=fetch_all_rows($dbh,"select grp_no_key,count(*) from bench1 group by grp_no_key"); + } + $end_time=new Benchmark; + print "Time for count_group ($i:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + + $loop_time=new Benchmark; + $rows=0; + for ($i=0 ; $i < $opt_medium_loop_count ; $i++) + { + $rows+=fetch_all_rows($dbh,"select grp_no_key,count(*) as cnt from bench1 group by grp_no_key order by cnt"); + } + $end_time=new Benchmark; + print "Time for count_group_with_order ($i:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; } if ($limits->{'group_distinct_functions'}) diff --git a/sql-bench/test-table-elimination.sh b/sql-bench/test-table-elimination.sh new file mode 100755 index 00000000000..5b494688bec --- /dev/null +++ b/sql-bench/test-table-elimination.sh @@ -0,0 +1,318 @@ +#!@PERL@ +# Test of table elimination feature + +use Cwd; +use DBI; +use Getopt::Long; +use Benchmark; + +$opt_loop_count=100000; +$opt_medium_loop_count=10000; +$opt_small_loop_count=100; + +$pwd = cwd(); $pwd = "." if ($pwd eq ''); +require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; + +if ($opt_small_test) +{ + $opt_loop_count/=10; + $opt_medium_loop_count/=10; + $opt_small_loop_count/=10; +} + +print "Testing table elimination feature\n"; +print "The test table has $opt_loop_count rows.\n\n"; + +# A query to get the recent versions of all attributes: +$select_current_full_facts=" + select + F.id, A1.attr1, A2.attr2 + from + elim_facts F + left join elim_attr1 A1 on A1.id=F.id + left join elim_attr2 A2 on A2.id=F.id and + A2.fromdate=(select MAX(fromdate) from + elim_attr2 where id=A2.id); +"; +$select_current_full_facts=" + select + F.id, A1.attr1, A2.attr2 + from + elim_facts F + left join elim_attr1 A1 on A1.id=F.id + left join elim_attr2 A2 on A2.id=F.id and + A2.fromdate=(select MAX(fromdate) from + elim_attr2 where id=F.id); +"; +# TODO: same as above but for some given date also? +# TODO: + + +#### +#### Connect and start timeing +#### + +$dbh = $server->connect(); +$start_time=new Benchmark; + +#### +#### Create needed tables +#### + +goto select_test if ($opt_skip_create); + +print "Creating tables\n"; +$dbh->do("drop table elim_facts" . $server->{'drop_attr'}); +$dbh->do("drop table elim_attr1" . $server->{'drop_attr'}); +$dbh->do("drop table elim_attr2" . $server->{'drop_attr'}); + +# The facts table +do_many($dbh,$server->create("elim_facts", + ["id integer"], + ["primary key (id)"])); + +# Attribute1, non-versioned +do_many($dbh,$server->create("elim_attr1", + ["id integer", + "attr1 integer"], + ["primary key (id)", + "key (attr1)"])); + +# Attribute2, time-versioned +do_many($dbh,$server->create("elim_attr2", + ["id integer", + "attr2 integer", + "fromdate date"], + ["primary key (id, fromdate)", + "key (attr2,fromdate)"])); + +#NOTE: ignoring: if ($limits->{'views'}) +$dbh->do("drop view elim_current_facts"); +$dbh->do("create view elim_current_facts as $select_current_full_facts"); + +if ($opt_lock_tables) +{ + do_query($dbh,"LOCK TABLES elim_current_facts WRITE, elim_facts WRITE, elim_attr1 WRITE, elim_attr2 WRITE"); +} + +if ($opt_fast && defined($server->{vacuum})) +{ + $server->vacuum(1,\$dbh); +} + +#### +#### Fill the facts table +#### +$n_facts= $opt_loop_count; + +if ($opt_fast && $server->{transactions}) +{ + $dbh->{AutoCommit} = 0; +} + +print "Inserting $n_facts rows into facts table\n"; +$loop_time=new Benchmark; + +$query="insert into elim_facts values ("; +for ($id=0; $id < $n_facts ; $id++) +{ + do_query($dbh,"$query $id)"); +} + +if ($opt_fast && $server->{transactions}) +{ + $dbh->commit; + $dbh->{AutoCommit} = 1; +} + +$end_time=new Benchmark; +print "Time to insert ($n_facts): " . + timestr(timediff($end_time, $loop_time),"all") . "\n\n"; + +#### +#### Fill attr1 table +#### +if ($opt_fast && $server->{transactions}) +{ + $dbh->{AutoCommit} = 0; +} + +print "Inserting $n_facts rows into attr1 table\n"; +$loop_time=new Benchmark; + +$query="insert into elim_attr1 values ("; +for ($id=0; $id < $n_facts ; $id++) +{ + $attr1= ceil(rand($n_facts)); + do_query($dbh,"$query $id, $attr1)"); +} + +if ($opt_fast && $server->{transactions}) +{ + $dbh->commit; + $dbh->{AutoCommit} = 1; +} + +$end_time=new Benchmark; +print "Time to insert ($n_facts): " . + timestr(timediff($end_time, $loop_time),"all") . "\n\n"; + +#### +#### Fill attr2 table +#### +if ($opt_fast && $server->{transactions}) +{ + $dbh->{AutoCommit} = 0; +} + +print "Inserting $n_facts rows into attr2 table\n"; +$loop_time=new Benchmark; + +for ($id=0; $id < $n_facts ; $id++) +{ + # Two values for each $id - current one and obsolete one. + $attr1= ceil(rand($n_facts)); + $query="insert into elim_attr2 values ($id, $attr1, now())"; + do_query($dbh,$query); + $query="insert into elim_attr2 values ($id, $attr1, '2009-01-01')"; + do_query($dbh,$query); +} + +if ($opt_fast && $server->{transactions}) +{ + $dbh->commit; + $dbh->{AutoCommit} = 1; +} + +$end_time=new Benchmark; +print "Time to insert ($n_facts): " . + timestr(timediff($end_time, $loop_time),"all") . "\n\n"; + +#### +#### Finalize the database population +#### + +if ($opt_lock_tables) +{ + do_query($dbh,"UNLOCK TABLES"); +} + +if ($opt_fast && defined($server->{vacuum})) +{ + $server->vacuum(1,\$dbh,"elim_facts"); + $server->vacuum(1,\$dbh,"elim_attr1"); + $server->vacuum(1,\$dbh,"elim_attr2"); +} + +if ($opt_lock_tables) +{ + do_query($dbh,"LOCK TABLES elim_current_facts READ, elim_facts READ, elim_attr1 READ, elim_attr2 READ"); +} + +#### +#### Do some selects on the table +#### + +select_test: + +# +# The selects will be: +# - N pk-lookups with all attributes +# - pk-attribute-based lookup +# - latest-attribute value based lookup. + + +### +### Bare facts select: +### +print "testing bare facts facts table\n"; +$loop_time=new Benchmark; +$rows=0; +for ($i=0 ; $i < $opt_medium_loop_count ; $i++) +{ + $val= ceil(rand($n_facts)); + $rows+=fetch_all_rows($dbh,"select * from elim_facts where id=$val"); +} +$count=$i; + +$end_time=new Benchmark; +print "time for select_bare_facts ($count:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + + +### +### Full facts select, no elimination: +### +print "testing full facts facts table\n"; +$loop_time=new Benchmark; +$rows=0; +for ($i=0 ; $i < $opt_medium_loop_count ; $i++) +{ + $val= rand($n_facts); + $rows+=fetch_all_rows($dbh,"select * from elim_current_facts where id=$val"); +} +$count=$i; + +$end_time=new Benchmark; +print "time for select_two_attributes ($count:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + +### +### Now with elimination: select only only one fact +### +print "testing selection of one attribute\n"; +$loop_time=new Benchmark; +$rows=0; +for ($i=0 ; $i < $opt_medium_loop_count ; $i++) +{ + $val= rand($n_facts); + $rows+=fetch_all_rows($dbh,"select id, attr1 from elim_current_facts where id=$val"); +} +$count=$i; + +$end_time=new Benchmark; +print "time for select_one_attribute ($count:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + +### +### Now with elimination: select only only one fact +### +print "testing selection of one attribute\n"; +$loop_time=new Benchmark; +$rows=0; +for ($i=0 ; $i < $opt_medium_loop_count ; $i++) +{ + $val= rand($n_facts); + $rows+=fetch_all_rows($dbh,"select id, attr2 from elim_current_facts where id=$val"); +} +$count=$i; + +$end_time=new Benchmark; +print "time for select_one_attribute ($count:$rows): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + + +; + +#### +#### End of benchmark +#### + +if ($opt_lock_tables) +{ + do_query($dbh,"UNLOCK TABLES"); +} +if (!$opt_skip_delete) +{ + do_query($dbh,"drop table elim_facts, elim_attr1, elim_attr2" . $server->{'drop_attr'}); +} + +if ($opt_fast && defined($server->{vacuum})) +{ + $server->vacuum(0,\$dbh); +} + +$dbh->disconnect; # close connection + +end_benchmark($start_time); + diff --git a/sql-bench/test-transactions.sh b/sql-bench/test-transactions.sh index f6672619da0..b0aee8c6d38 100644 --- a/sql-bench/test-transactions.sh +++ b/sql-bench/test-transactions.sh @@ -29,8 +29,8 @@ use Benchmark; $opt_groups=27; # Characters are 'A' -> Z -$opt_loop_count=10000; # Change this to make test harder/easier -$opt_medium_loop_count=100; # Change this to make test harder/easier +$opt_loop_count=500000; # Change this to make test harder/easier +$opt_medium_loop_count=10000; # Change this to make test harder/easier $pwd = cwd(); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; diff --git a/sql-bench/test-wisconsin.sh b/sql-bench/test-wisconsin.sh index 10519694bf0..4fb3bc65f35 100644 --- a/sql-bench/test-wisconsin.sh +++ b/sql-bench/test-wisconsin.sh @@ -22,7 +22,7 @@ use Cwd; use DBI; use Benchmark; -$opt_loop_count=10; +$opt_loop_count=5000; $pwd = cwd(); $pwd = "." if ($pwd eq ''); require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n"; |