mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
ee1c5226b9
Fixed memory leak in _db_set() (Bug#24497 Valgrind warning: get_one_option) Don't call net_clear() on COM_QUIT. This avoids a warning from net_clear() after shutdown: "skipped ## bytes from file" BUG#21428: skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown" sql-bench/test-wisconsin.sh: Rename: BitKeeper/deleted/.del-test-wisconsin.sh~c0b86821b5f95f26 -> sql-bench/test-wisconsin.sh sql-bench/test-transactions.sh: Rename: BitKeeper/deleted/.del-test-transactions.sh~c1c892f10c40caf -> sql-bench/test-transactions.sh sql-bench/test-insert.sh: Rename: BitKeeper/deleted/.del-test-insert.sh~893bfac9dedb79a7 -> sql-bench/test-insert.sh sql-bench/test-select.sh: Rename: BitKeeper/deleted/.del-test-select.sh~6d5cc770acf11be6 -> sql-bench/test-select.sh sql-bench/test-create.sh: Rename: BitKeeper/deleted/.del-test-create.sh~f9a1ea38c191b17a -> sql-bench/test-create.sh sql-bench/test-big-tables.sh: Rename: BitKeeper/deleted/.del-test-big-tables.sh~5b1b0c5fb623565a -> sql-bench/test-big-tables.sh sql-bench/test-connect.sh: Rename: BitKeeper/deleted/.del-test-connect.sh~382a728c949ee075 -> sql-bench/test-connect.sh sql-bench/test-ATIS.sh: Rename: BitKeeper/deleted/.del-test-ATIS.sh~e8ebff7086c95773 -> sql-bench/test-ATIS.sh sql-bench/test-alter-table.sh: Rename: BitKeeper/deleted/.del-test-alter-table.sh~eba6cfa9972fcced -> sql-bench/test-alter-table.sh sql-bench/innotest2b.sh: Rename: BitKeeper/deleted/.del-innotest2b.sh~7b99ece835e8dff3 -> sql-bench/innotest2b.sh sql-bench/run-all-tests.sh: Rename: BitKeeper/deleted/.del-run-all-tests.sh~41d6da1cf211ee95 -> sql-bench/run-all-tests.sh sql-bench/innotest2.sh: Rename: BitKeeper/deleted/.del-innotest2.sh~9c14df528285603 -> sql-bench/innotest2.sh sql-bench/innotest2a.sh: Rename: BitKeeper/deleted/.del-innotest2a.sh~e01d016a7cafdc0b -> sql-bench/innotest2a.sh sql-bench/innotest1a.sh: Rename: BitKeeper/deleted/.del-innotest1a.sh~c64f4610ae1e26fe -> sql-bench/innotest1a.sh sql-bench/innotest1b.sh: Rename: BitKeeper/deleted/.del-innotest1b.sh~aafd0819ae84da7b -> sql-bench/innotest1b.sh sql-bench/innotest1.sh: Rename: BitKeeper/deleted/.del-innotest1.sh~aa36bce09ca783c7 -> sql-bench/innotest1.sh sql-bench/crash-me.sh: Rename: BitKeeper/deleted/.del-crash-me.sh~2fa881d0b40339c8 -> sql-bench/crash-me.sh sql-bench/graph-compare-results.sh: Rename: BitKeeper/deleted/.del-graph-compare-results.sh~7e4e28b3591b4542 -> sql-bench/graph-compare-results.sh sql-bench/copy-db.sh: Rename: BitKeeper/deleted/.del-copy-db.sh~e8116afb93144ccd -> sql-bench/copy-db.sh sql-bench/compare-results.sh: Rename: BitKeeper/deleted/.del-compare-results.sh~a9e26e2644c694b3 -> sql-bench/compare-results.sh sql-bench/bench-count-distinct.sh: Rename: BitKeeper/deleted/.del-bench-count-distinct.sh~a92f174271a831d7 -> sql-bench/bench-count-distinct.sh sql-bench/as3ap.sh: Rename: BitKeeper/deleted/.del-as3ap.sh~f54eebbd8d34c9b6 -> sql-bench/as3ap.sh sql-bench/Comments/Informix.crash-me: Rename: BitKeeper/deleted/.del-Informix.crash-me~51ab5b717cefe74 -> sql-bench/Comments/Informix.crash-me sql-bench/Comments/postgres.crash-me: Rename: BitKeeper/deleted/.del-postgres.crash-me~eacac145c3e30f17 -> sql-bench/Comments/postgres.crash-me sql-bench/Comments/Empress.crash-me: Rename: BitKeeper/deleted/.del-Empress.crash-me~bdaff0c68ce10f02 -> sql-bench/Comments/Empress.crash-me sql-bench/Comments/Adabas.crash-me: Rename: BitKeeper/deleted/.del-Adabas.crash-me~ce88ba1a540971ac -> sql-bench/Comments/Adabas.crash-me sql-bench/Comments/Access.crash-me: Rename: BitKeeper/deleted/.del-Access.crash-me~bb457ec282d939b6 -> sql-bench/Comments/Access.crash-me sql-bench/Comments/postgres.benchmark: Rename: BitKeeper/deleted/.del-postgres.benchmark~4d30890732b784a -> sql-bench/Comments/postgres.benchmark sql-bench/Comments/mysql.benchmark: Rename: BitKeeper/deleted/.del-mysql.benchmark~4d8729c0937456fc -> sql-bench/Comments/mysql.benchmark sql-bench/Comments/FrontBase.benchmark: Rename: BitKeeper/deleted/.del-FrontBase.benchmark~217041ef18274c2e -> sql-bench/Comments/FrontBase.benchmark sql-bench/Comments/interbase: Rename: BitKeeper/deleted/.del-interbase~cdad59622b4d6f3 -> sql-bench/Comments/interbase sql-bench/uname.bat: Rename: BitKeeper/deleted/.del-uname.bat~a6d933d2ee9314c -> sql-bench/uname.bat sql-bench/pwd.bat: Rename: BitKeeper/deleted/.del-pwd.bat~9b64050849abf51 -> sql-bench/pwd.bat sql-bench/example.bat: Rename: BitKeeper/deleted/.del-example.bat~22d0170bccf0f030 -> sql-bench/example.bat sql-bench/Makefile.am: Rename: BitKeeper/deleted/.del-Makefile.am~7b07da85b2e9375 -> sql-bench/Makefile.am sql-bench/Data/ATIS/transport.txt: Rename: BitKeeper/deleted/.del-transport.txt~fa4ca40735f8354c -> sql-bench/Data/ATIS/transport.txt sql-bench/Data/ATIS/time_zone.txt: Rename: BitKeeper/deleted/.del-time_zone.txt~4171f9ca732f65c0 -> sql-bench/Data/ATIS/time_zone.txt sql-bench/Data/Wisconsin/tenk.data: Rename: BitKeeper/deleted/.del-tenk.data~6aeaebdd534e458e -> sql-bench/Data/Wisconsin/tenk.data sql-bench/Data/Wisconsin/onek.data: Rename: BitKeeper/deleted/.del-onek.data~6cd1edaf596a7f7 -> sql-bench/Data/Wisconsin/onek.data sql-bench/Data/ATIS/stop1.txt: Rename: BitKeeper/deleted/.del-stop1.txt~f09ba164ad44a288 -> sql-bench/Data/ATIS/stop1.txt sql-bench/Data/ATIS/time_interval.txt: Rename: BitKeeper/deleted/.del-time_interval.txt~a1def62e267a59b2 -> sql-bench/Data/ATIS/time_interval.txt sql-bench/Data/ATIS/stop.txt: Rename: BitKeeper/deleted/.del-stop.txt~31fb564e1f415e34 -> sql-bench/Data/ATIS/stop.txt sql-bench/Data/ATIS/restriction.txt: Rename: BitKeeper/deleted/.del-restriction.txt~6ae208924617784a -> sql-bench/Data/ATIS/restriction.txt sql-bench/Data/ATIS/state.txt: Rename: BitKeeper/deleted/.del-state.txt~9dd470ce14075b90 -> sql-bench/Data/ATIS/state.txt sql-bench/Data/ATIS/restrict_class.txt: Rename: BitKeeper/deleted/.del-restrict_class.txt~2f741bf0ea498f84 -> sql-bench/Data/ATIS/restrict_class.txt sql-bench/Data/ATIS/month_name.txt: Rename: BitKeeper/deleted/.del-month_name.txt~4c44f7a323d57d92 -> sql-bench/Data/ATIS/month_name.txt sql-bench/Data/ATIS/restrict_carrier.txt: Rename: BitKeeper/deleted/.del-restrict_carrier.txt~925b5492f3f9cba3 -> sql-bench/Data/ATIS/restrict_carrier.txt sql-bench/Data/ATIS/ground_service.txt: Rename: BitKeeper/deleted/.del-ground_service.txt~1087e477e86e84c -> sql-bench/Data/ATIS/ground_service.txt sql-bench/Data/ATIS/food_service.txt: Rename: BitKeeper/deleted/.del-food_service.txt~66d95a150c28458 -> sql-bench/Data/ATIS/food_service.txt sql-bench/Data/ATIS/flight_day.txt: Rename: BitKeeper/deleted/.del-flight_day.txt~76868d6d265d441e -> sql-bench/Data/ATIS/flight_day.txt sql-bench/Data/ATIS/flight_fare.txt: Rename: BitKeeper/deleted/.del-flight_fare.txt~d7322593c8530487 -> sql-bench/Data/ATIS/flight_fare.txt sql-bench/Data/ATIS/flight_class.txt: Rename: BitKeeper/deleted/.del-flight_class.txt~1801101474c29098 -> sql-bench/Data/ATIS/flight_class.txt sql-bench/Data/ATIS/fconnection.txt: Rename: BitKeeper/deleted/.del-fconnection.txt~e0ef6a8b5560a713 -> sql-bench/Data/ATIS/fconnection.txt sql-bench/Data/ATIS/flight.txt: Rename: BitKeeper/deleted/.del-flight.txt~e5065423760e99eb -> sql-bench/Data/ATIS/flight.txt sql-bench/Data/ATIS/fare.txt: Rename: BitKeeper/deleted/.del-fare.txt~ea0652f490bc24a6 -> sql-bench/Data/ATIS/fare.txt sql-bench/Data/ATIS/day_name.txt: Rename: BitKeeper/deleted/.del-day_name.txt~f813b215955d894c -> sql-bench/Data/ATIS/day_name.txt sql-bench/Data/ATIS/dual_carrier.txt: Rename: BitKeeper/deleted/.del-dual_carrier.txt~a7dd776224fbd92b -> sql-bench/Data/ATIS/dual_carrier.txt sql-bench/Data/ATIS/date_day.txt: Rename: BitKeeper/deleted/.del-date_day.txt~4e9a282fcf54cfd8 -> sql-bench/Data/ATIS/date_day.txt sql-bench/Data/ATIS/compound_class.txt: Rename: BitKeeper/deleted/.del-compound_class.txt~d4a2f1b7f96340b9 -> sql-bench/Data/ATIS/compound_class.txt sql-bench/Data/ATIS/connect_leg.txt: Rename: BitKeeper/deleted/.del-connect_leg.txt~f97b6e94e108bb36 -> sql-bench/Data/ATIS/connect_leg.txt sql-bench/Data/ATIS/code_description.txt: Rename: BitKeeper/deleted/.del-code_description.txt~f9117373e438b0e2 -> sql-bench/Data/ATIS/code_description.txt sql-bench/Data/ATIS/city.txt: Rename: BitKeeper/deleted/.del-city.txt~d96dd6d073344d2e -> sql-bench/Data/ATIS/city.txt sql-bench/Data/ATIS/class_of_service.txt: Rename: BitKeeper/deleted/.del-class_of_service.txt~21f6b9848b8c76d -> sql-bench/Data/ATIS/class_of_service.txt sql-bench/Data/ATIS/airport_service.txt: Rename: BitKeeper/deleted/.del-airport_service.txt~6ee6d5b852b3e38 -> sql-bench/Data/ATIS/airport_service.txt sql-bench/Data/ATIS/airline.txt: Rename: BitKeeper/deleted/.del-airline.txt~a79f8eadf853f2c8 -> sql-bench/Data/ATIS/airline.txt sql-bench/Data/ATIS/airport.txt: Rename: BitKeeper/deleted/.del-airport.txt~59c78514130e1f45 -> sql-bench/Data/ATIS/airport.txt sql-bench/Data/ATIS/aircraft.txt: Rename: BitKeeper/deleted/.del-aircraft.txt~15e4de7ab37c92d3 -> sql-bench/Data/ATIS/aircraft.txt sql-bench/TODO: Rename: BitKeeper/deleted/.del-TODO~cac6d7a63c426ae5 -> sql-bench/TODO sql-bench/limits/sybase.cfg: Rename: BitKeeper/deleted/.del-sybase.cfg~c4636b12767b3f14 -> sql-bench/limits/sybase.cfg sql-bench/limits/solid-nt4.cfg: Rename: BitKeeper/deleted/.del-solid-nt4.cfg~cca779f0c9e29d31 -> sql-bench/limits/solid-nt4.cfg sql-bench/limits/solid.cfg: Rename: BitKeeper/deleted/.del-solid.cfg~5ae0e4342eadb0fb -> sql-bench/limits/solid.cfg sql-bench/limits/pg.cfg: Rename: BitKeeper/deleted/.del-pg.cfg~db59cf39a5d417be -> sql-bench/limits/pg.cfg sql-bench/limits/mysql.cfg: Rename: BitKeeper/deleted/.del-mysql.cfg~9cab20a8771b93cf -> sql-bench/limits/mysql.cfg sql-bench/limits/oracle.cfg: Rename: BitKeeper/deleted/.del-oracle.cfg~affab21af8f438fd -> sql-bench/limits/oracle.cfg sql-bench/limits/mysql-4.1.cfg: Rename: BitKeeper/deleted/.del-mysql-4.1.cfg~b6c5e74aefc99e3c -> sql-bench/limits/mysql-4.1.cfg sql-bench/limits/mysql-3.23.cfg: Rename: BitKeeper/deleted/.del-mysql-3.23.cfg~3cf9d6be54b77a3c -> sql-bench/limits/mysql-3.23.cfg sql-bench/limits/mysql-4.0.cfg: Rename: BitKeeper/deleted/.del-mysql-4.0.cfg~6c9d63c85b5ef574 -> sql-bench/limits/mysql-4.0.cfg sql-bench/limits/mysql-3.22.cfg: Rename: BitKeeper/deleted/.del-mysql-3.22.cfg~e706f26a161175cd -> sql-bench/limits/mysql-3.22.cfg sql-bench/limits/msql.cfg: Rename: BitKeeper/deleted/.del-msql.cfg~52710b12932cceb9 -> sql-bench/limits/msql.cfg sql-bench/limits/ms-sql65.cfg: Rename: BitKeeper/deleted/.del-ms-sql65.cfg~6b9bc3c460dbee05 -> sql-bench/limits/ms-sql65.cfg sql-bench/limits/mimer.cfg: Rename: BitKeeper/deleted/.del-mimer.cfg~234e6c1c3c47b612 -> sql-bench/limits/mimer.cfg sql-bench/limits/ms-sql.cfg: Rename: BitKeeper/deleted/.del-ms-sql.cfg~1907964264d2786a -> sql-bench/limits/ms-sql.cfg sql-bench/limits/interbase.cfg: Rename: BitKeeper/deleted/.del-interbase.cfg~c6951a0376cc6ff3 -> sql-bench/limits/interbase.cfg sql-bench/limits/interbase-dialect3.cfg: Rename: BitKeeper/deleted/.del-interbase-dialect3.cfg~46277bdfc74c667a -> sql-bench/limits/interbase-dialect3.cfg sql-bench/limits/interbase-superserver.cfg: Rename: BitKeeper/deleted/.del-interbase-superserver.cfg~22501198689243b0 -> sql-bench/limits/interbase-superserver.cfg sql-bench/limits/interbase-dialect1.cfg: Rename: BitKeeper/deleted/.del-interbase-dialect1.cfg~659206b5b9a11036 -> sql-bench/limits/interbase-dialect1.cfg sql-bench/limits/empress.cfg: Rename: BitKeeper/deleted/.del-empress.cfg~1f97f34d6560a499 -> sql-bench/limits/empress.cfg sql-bench/limits/frontbase.cfg: Rename: BitKeeper/deleted/.del-frontbase.cfg~71369e9c002696e -> sql-bench/limits/frontbase.cfg sql-bench/limits/db2.cfg: Rename: BitKeeper/deleted/.del-db2.cfg~711099b4d7906959 -> sql-bench/limits/db2.cfg sql-bench/limits/access.cfg: Rename: BitKeeper/deleted/.del-access.cfg~5239ea3655b7bba0 -> sql-bench/limits/access.cfg sql-bench/limits/access_odbc.cfg: Rename: BitKeeper/deleted/.del-access_odbc.cfg~34b4cf0eda56c4b1 -> sql-bench/limits/access_odbc.cfg sql-bench/limits/Informix.cfg: Rename: BitKeeper/deleted/.del-Informix.cfg~b94188e1ececb51b -> sql-bench/limits/Informix.cfg sql-bench/limits/Adabas.cfg: Rename: BitKeeper/deleted/.del-Adabas.cfg~343ed4e7f8b02111 -> sql-bench/limits/Adabas.cfg sql-bench/README: Rename: BitKeeper/deleted/.del-README~b1aa0c1bf9f5eb5e -> sql-bench/README BitKeeper/deleted/.del-create-pg_fast-Linux_2.2.14_my_SMP_i686-crashed: Delete: sql-bench/Results/create-pg_fast-Linux_2.2.14_my_SMP_i686-crashed Makefile.am: Added back sql-bench configure.in: Added back sql-bench dbug/dbug.c: Fixed memory leak in _db_set() This is not a complete fix as we can still get memory leaks if we do any of the following: mysqld --debug --debug CAll DBUG_SET or DBUG_SET_INITIAL more than once in a program Use SET @@global.debug=xxxx At some point we should fix the above, but this is not critical for normal operation (only for debugging) Bug #24497 Valgrind warning: get_one_option Note that all changes to _db_set_ is only a variable access change, and can be ignored while reviewing the bug fix. mysql-test/t/flush_read_lock_kill-master.opt: Added '+' to option, to be able to use this together with --debug mysql-test/valgrind.supp: Removed warning that is now fixed mysys/ptr_cmp.c: Fixed wrong pointer read (probably never used) scripts/make_binary_distribution.sh: Added back sql_bench sql/field.h: Removed class function that was identical in parent class sql/mysqld.cc: Removed some calls to my_thread_init() / my_thread_end() that was not needed. Only call DBUG_SET_INITAL, not DBUG_SET (Fixes memory leak in dbug) Mark some code as deadcode sql/net_serv.cc: Add information about from where error comes sql-bench/bench-init.pl.sh: Cleaned up help text sql-bench/server-cfg.sh: Don't write '/' after server name of no ssl version sql-common/client.c: Don't call net_clear() on COM_QUIT. This avoids a warning from net_clear() after shutdown: "skipped ## bytes from file" BUG#21428: skipped 9 bytes from file: socket (3)" on "mysqladmin shutdown" sql/sql_parse.cc: Added comment sql/table.h: Removed compiler warning
637 lines
21 KiB
Bash
637 lines
21 KiB
Bash
#!@PERL@
|
|
# Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
|
#
|
|
# This library is free software; you can redistribute it and/or
|
|
# modify it under the terms of the GNU Library General Public
|
|
# License as published by the Free Software Foundation; either
|
|
# version 2 of the License, or (at your option) any later version.
|
|
#
|
|
# This library is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
# Library General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Library General Public
|
|
# License along with this library; if not, write to the Free
|
|
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
|
# MA 02111-1307, USA
|
|
#
|
|
# AS3AP single-user benchmark.
|
|
#
|
|
|
|
##################### Standard benchmark inits ##############################
|
|
|
|
use Cwd;
|
|
use DBI;
|
|
use Benchmark;
|
|
|
|
$pwd = cwd(); $pwd = "." if ($pwd eq '');
|
|
require "$pwd/bench-init.pl" || die "Can't read Configuration file: $!\n";
|
|
|
|
$opt_loop_count=1;
|
|
|
|
#Create tables
|
|
|
|
$dbh = $server->connect();
|
|
|
|
#Create Table
|
|
$sth = $dbh->do("drop table uniques");
|
|
$sth = $dbh->do("drop table updates");
|
|
$sth = $dbh->do("drop table hundred");
|
|
$sth = $dbh->do("drop table tenpct");
|
|
$sth = $dbh->do("drop table tiny");
|
|
|
|
#Temporary table
|
|
$sth = $dbh->do("drop table saveupdates");
|
|
|
|
@fields=("col_key int not null",
|
|
"col_int int not null",
|
|
"col_signed int not null",
|
|
"col_float float not null",
|
|
"col_double float not null",
|
|
"col_decim numeric(18,2) not null",
|
|
"col_date char(20) not null",
|
|
"col_code char(10) not null",
|
|
"col_name char(20) not null",
|
|
"col_address varchar(80) not null");
|
|
|
|
do_many($dbh,$server->create("uniques",\@fields,[]));
|
|
do_many($dbh,$server->create("updates",\@fields,[]));
|
|
do_many($dbh,$server->create("hundred",\@fields,[]));
|
|
do_many($dbh,$server->create("tenpct",\@fields,[]));
|
|
do_many($dbh,$server->create("tiny",["col_key int not null"],[]));
|
|
|
|
print "Start AS3AP benchmark\n\n";
|
|
|
|
$start_time=new Benchmark;
|
|
|
|
print "Load DATA\n";
|
|
#Load DATA
|
|
|
|
@table_names=("uniques","updates","hundred","tenpct","tiny");
|
|
|
|
$loop_time=new Benchmark;
|
|
|
|
if ($opt_fast && $server->{'limits'}->{'load_data_infile'})
|
|
{
|
|
for ($ti = 0; $ti <= $#table_names; $ti++)
|
|
{
|
|
my $table_name = $table_names[$ti];
|
|
my $file = "$pwd/Data/AS3AP/${table_name}\.new";
|
|
print "$table_name - $file\n" if ($opt_debug);
|
|
$row_count += $server->insert_file($table_name,$file,$dbh);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for ($ti = 0; $ti <= $#table_names; $ti++)
|
|
{
|
|
my $table_name = $table_names[$ti];
|
|
print "$table_name - $file\n" if ($opt_debug);
|
|
my $insert_start = "insert into $table_name values (";
|
|
open(DATA, "$pwd/Data/AS3AP/${table_name}\.new") || die "Can't open text file: $pwd/Data/AS3AP/${table_name}\.new\n";
|
|
while(<DATA>)
|
|
{
|
|
chomp;
|
|
next unless ( $_ =~ /\w/ ); # skip blank lines
|
|
$command = $insert_start."$_".")";
|
|
$command =~ $server->fix_to_insert($command);
|
|
print "$command\n" if ($opt_debug);
|
|
$sth = $dbh->do($command) or die "Got error: $DBI::errstr when executing '$command'\n";
|
|
$row_count++;
|
|
}
|
|
close(DATA);
|
|
}
|
|
}
|
|
|
|
$end_time=new Benchmark;
|
|
print "Time for Load Data - " . "($row_count): " .
|
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
|
|
|
|
|
print "Create Index\n";
|
|
|
|
test_command("create_idx_uniques_key_bt",
|
|
"time for create_idx_uniques_key_bt",
|
|
"create unique index uniques_key_bt on uniques (col_key)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_updates_key_bt",
|
|
"time for create_idx_updates_key_bt",
|
|
"create unique index updates_key_bt on updates (col_key)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_hundred_key_bt",
|
|
"time for create_idx_hundred_key_bt",
|
|
"create unique index hundred_key_bt on hundred (col_key)",
|
|
$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_key_bt",
|
|
"time for create_idx_tenpct_key_bt",
|
|
"create unique index tenpct_key_bt on tenpct (col_key)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_key_code_bt",
|
|
"time for create_idx_tenpct_key_code_bt",
|
|
"create index tenpct_key_code_bt on tenpct (col_key,col_code)",
|
|
$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tiny_key_bt",
|
|
"time for create_idx_tiny_key_bt",
|
|
"create index tiny_key_bt on tiny (col_key)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_int_bt",
|
|
"time for create_idx_tenpct_int_bt",
|
|
"create index tenpct_int_bt on tenpct (col_int)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_signed_bt",
|
|
"time for create_idx_tenpct_signed_bt",
|
|
"create index tenpct_signed_bt on tenpct (col_signed)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_uniques_code_h",
|
|
"time for create_idx_uniques_code_h",
|
|
"create index uniques_code_h on uniques (col_code)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_double_bt",
|
|
"time for create_idx_tenpct_double_bt",
|
|
"create index tenpct_double_bt on tenpct (col_double)",$dbh,$opt_loop_count);
|
|
|
|
|
|
test_command("create_idx_updates_decim_bt",
|
|
"time for create_idx_updates_decim_bt",
|
|
"create index updates_decim_bt on updates (col_decim)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_float_bt",
|
|
"time for create_idx_tenpct_float_bt",
|
|
"create index tenpct_float_bt on tenpct (col_float)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_updates_int_bt",
|
|
"time for create_idx_updates_int_bt",
|
|
"create index updates_int_bt on updates (col_int)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_decim_bt",
|
|
"time for create_idx_tenpct_decim_bt",
|
|
"create index tenpct_decim_bt on tenpct (col_decim)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_hundred_code_h",
|
|
"time for create_idx_hundred_code_h",
|
|
"create index hundred_code_h on hundred (col_code)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_name_h",
|
|
"time for create_idx_tenpct_name_h",
|
|
"create index tenpct_name_h on tenpct (col_name)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_updates_code_h",
|
|
"time for create_idx_updates_code_h",
|
|
"create index updates_code_h on updates (col_code)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_tenpct_code_h",
|
|
"time for create_idx_tenpct_code_h",
|
|
"create index tenpct_code_h on tenpct (col_code)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_updates_double_bt",
|
|
"time for create_idx_updates_double_bt",
|
|
"create index updates_double_bt on updates (col_double)",$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_hundred_foreign",
|
|
"time for create_idx_hundred_foreign",
|
|
"alter table hundred add constraint fk_hundred_updates foreign key (col_signed)
|
|
references updates (col_key)",$dbh,$opt_loop_count);
|
|
|
|
test_query("sel_1_cl",
|
|
"Time to sel_1_cl",
|
|
"select col_key, col_int, col_signed, col_code, col_double, col_name
|
|
from updates where col_key = 1000",$dbh,$opt_loop_count);
|
|
|
|
test_query("join_3_cl",
|
|
"Time to join_3_cl",
|
|
"select uniques.col_signed, uniques.col_date,
|
|
hundred.col_signed, hundred.col_date,
|
|
tenpct.col_signed, tenpct.col_date
|
|
from uniques, hundred, tenpct
|
|
where uniques.col_key = hundred.col_key
|
|
and uniques.col_key = tenpct.col_key
|
|
and uniques.col_key = 1000",$dbh,$opt_loop_count);
|
|
|
|
test_query("sel_100_ncl",
|
|
"Time to sel_100_ncl",
|
|
"select col_key, col_int, col_signed, col_code,col_double, col_name
|
|
from updates where col_int <= 100",$dbh,$opt_loop_count);
|
|
|
|
test_query("table_scan",
|
|
"Time to table_scan",
|
|
"select * from uniques where col_int = 1",$dbh,$opt_loop_count);
|
|
|
|
test_query("agg_func",
|
|
"Time for agg_func",
|
|
"select min(col_key) from hundred group by col_name",$dbh,$opt_loop_count);
|
|
|
|
test_query("agg_scal",
|
|
"Time for agg_scal",
|
|
"select min(col_key) from uniques",$dbh,$opt_loop_count);
|
|
|
|
test_query("sel_100_cl",
|
|
"Time for sel_100_cl",
|
|
"select col_key, col_int, col_signed, col_code,
|
|
col_double, col_name
|
|
from updates where col_key <= 100",$dbh,$opt_loop_count);
|
|
|
|
test_query("join_3_ncl",
|
|
"Time for join_3_ncl",
|
|
"select uniques.col_signed, uniques.col_date,
|
|
hundred.col_signed, hundred.col_date,
|
|
tenpct.col_signed, tenpct.col_date
|
|
from uniques, hundred, tenpct
|
|
where uniques.col_code = hundred.col_code
|
|
and uniques.col_code = tenpct.col_code
|
|
and uniques.col_code = 'BENCHMARKS'",$dbh,$opt_loop_count);
|
|
|
|
test_query("sel_10pct_ncl",
|
|
"Time for sel_10pct_ncl",
|
|
"select col_key, col_int, col_signed, col_code,
|
|
col_double, col_name
|
|
from tenpct
|
|
where col_name = 'THE+ASAP+BENCHMARKS+'",$dbh,$opt_loop_count);
|
|
|
|
if ($limits->{'subqueries'}){
|
|
test_query("agg_simple_report",
|
|
"Time for agg_simple_report",
|
|
"select avg(updates.col_decim)
|
|
from updates
|
|
where updates.col_key in
|
|
(select updates.col_key
|
|
from updates, hundred
|
|
where hundred.col_key = updates.col_key
|
|
and updates.col_decim > 980000000)",$dbh,$opt_loop_count);
|
|
}else{
|
|
print "agg_simple_report - Failed\n\n";
|
|
}
|
|
|
|
test_query("agg_info_retrieval",
|
|
"Time for agg_info_retrieval",
|
|
"select count(col_key)
|
|
from tenpct
|
|
where col_name = 'THE+ASAP+BENCHMARKS'
|
|
and col_int <= 100000000
|
|
and col_signed between 1 and 99999999
|
|
and not (col_float between -450000000 and 450000000)
|
|
and col_double > 600000000
|
|
and col_decim < -600000000",$dbh,$opt_loop_count);
|
|
|
|
if ($limits->{'views'}){
|
|
test_query("agg_create_view",
|
|
"Time for agg_create_view",
|
|
"create view
|
|
reportview(col_key,col_signed,col_date,col_decim,
|
|
col_name,col_code,col_int) as
|
|
select updates.col_key, updates.col_signed,
|
|
updates.col_date, updates.col_decim,
|
|
hundred.col_name, hundred.col_code,
|
|
hundred.col_int
|
|
from updates, hundred
|
|
where updates.col_key = hundred.col_key",$dbh,$opt_loop_count);
|
|
|
|
test_query("agg_subtotal_report",
|
|
"Time for agg_subtotal_report",
|
|
"select avg(col_signed), min(col_signed), max(col_signed),
|
|
max(col_date), min(col_date),
|
|
count(distinct col_name), count(col_name),
|
|
col_code, col_int
|
|
from reportview
|
|
where col_decim >980000000
|
|
group by col_code, col_int",$dbh,$opt_loop_count);
|
|
|
|
|
|
test_query("agg_total_report",
|
|
"Time for agg_total_report",
|
|
"select avg(col_signed), min(col_signed), max(col_signed),
|
|
max(col_date), min(col_date),
|
|
count(distinct col_name), count(col_name),
|
|
count(col_code), count(col_int)
|
|
from reportview
|
|
where col_decim >980000000",$dbh,$opt_loop_count);
|
|
}else{
|
|
print "agg_create_view - Failed\n\n";
|
|
print "agg_subtotal_report - Failed\n\n";
|
|
print "agg_total_report - Failed\n\n";
|
|
}
|
|
|
|
#fix from here
|
|
test_query("join_2_cl",
|
|
"Time for join_2_cl",
|
|
"select uniques.col_signed, uniques.col_name,
|
|
hundred.col_signed, hundred.col_name
|
|
from uniques, hundred
|
|
where uniques.col_key = hundred.col_key
|
|
and uniques.col_key =1000"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("join_2",
|
|
"Time for join_2",
|
|
"select uniques.col_signed, uniques.col_name,
|
|
hundred.col_signed, hundred.col_name
|
|
from uniques, hundred
|
|
where uniques.col_address = hundred.col_address
|
|
and uniques.col_address = 'SILICON VALLEY'"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("sel_variable_select_low",
|
|
"Time for sel_variable_select_low",
|
|
"select col_key, col_int, col_signed, col_code,
|
|
col_double, col_name
|
|
from tenpct
|
|
where col_signed < -500000000"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("sel_variable_select_high",
|
|
"Time for sel_variable_select_high",
|
|
"select col_key, col_int, col_signed, col_code,
|
|
col_double, col_name
|
|
from tenpct
|
|
where col_signed < -250000000"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("join_4_cl",
|
|
"Time for join_4_cl",
|
|
"select uniques.col_date, hundred.col_date,
|
|
tenpct.col_date, updates.col_date
|
|
from uniques, hundred, tenpct, updates
|
|
where uniques.col_key = hundred.col_key
|
|
and uniques.col_key = tenpct.col_key
|
|
and uniques.col_key = updates.col_key
|
|
and uniques.col_key = 1000"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("proj_100",
|
|
"Time for proj_100",
|
|
"select distinct col_address, col_signed from hundred"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("join_4_ncl",
|
|
"Time for join_4_ncl",
|
|
"select uniques.col_date, hundred.col_date,
|
|
tenpct.col_date, updates.col_date
|
|
from uniques, hundred, tenpct, updates
|
|
where uniques.col_code = hundred.col_code
|
|
and uniques.col_code = tenpct.col_code
|
|
and uniques.col_code = updates.col_code
|
|
and uniques.col_code = 'BENCHMARKS'"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("proj_10pct",
|
|
"Time for proj_10pct",
|
|
"select distinct col_signed from tenpct"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("sel_1_ncl",
|
|
"Time for sel_1_ncl",
|
|
"select col_key, col_int, col_signed, col_code,
|
|
col_double, col_name
|
|
from updates where col_code = 'BENCHMARKS'"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_query("join_2_ncl",
|
|
"Time for join_2_ncl",
|
|
"select uniques.col_signed, uniques.col_name,
|
|
hundred.col_signed, hundred.col_name
|
|
from uniques, hundred
|
|
where uniques.col_code = hundred.col_code
|
|
and uniques.col_code = 'BENCHMARKS'"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
if ($limits->{'foreign_key'}){
|
|
do_many($dbh,$server->create("integrity_temp",\@fields,[]));
|
|
|
|
test_query("integrity_test_1",
|
|
"Time for integrity_test",
|
|
"insert into integrity_temp select *
|
|
from hundred where col_int=0",$dbh,$opt_loop_count);
|
|
|
|
test_query("integrity_test_2",
|
|
"Time for integrity_test",
|
|
"update hundred set col_signed = '-500000000'
|
|
where col_int = 0",$dbh,$opt_loop_count);
|
|
|
|
test_query("integrity_test_3",
|
|
"Time for integrity_test",
|
|
"update hundred set col_signed = '-500000000'
|
|
where col_int = 0",$dbh,$opt_loop_count);
|
|
|
|
|
|
}else{
|
|
print "integrity_test - Failed\n\n";
|
|
}
|
|
|
|
push @drop_seq_command,$server->drop_index("updates","updates_int_bt");
|
|
push @drop_seq_command,$server->drop_index("updates","updates_double_bt");
|
|
push @drop_seq_command,$server->drop_index("updates","updates_decim_bt");
|
|
push @drop_seq_command,$server->drop_index("updates","updates_code_h");
|
|
|
|
test_many_command("Drop updates keys",
|
|
"Time for drop_updates_keys",
|
|
\@drop_seq_command,$dbh,$opt_loop_count);
|
|
|
|
do_many($dbh,$server->create("saveupdates",\@fields,[]));
|
|
|
|
test_command("bulk_save",
|
|
"Time for bulk_save",
|
|
"insert into saveupdates select *
|
|
from updates where col_key between 5000 and 5999"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("bulk_modify",
|
|
"Time for bulk_modify",
|
|
"update updates
|
|
set col_key = col_key - 100000
|
|
where col_key between 5000 and 5999"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
safe_command("upd_append_duplicate",
|
|
"Time for upd_append_duplicate",
|
|
"insert into updates
|
|
values (6000, 0, 60000, 39997.90,
|
|
50005.00, 50005.00,
|
|
'11/10/1985', 'CONTROLLER',
|
|
'ALICE IN WONDERLAND',
|
|
'UNIVERSITY OF ILLINOIS AT CHICAGO')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_remove_duplicate",
|
|
"Time for upd_remove_duplicate",
|
|
"delete from updates where col_key = 6000 and col_int = 0"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_app_t_mid",
|
|
"Time for upd_app_t_mid",
|
|
"insert into updates
|
|
values (5005, 5005, 50005, 50005.00, 50005.00,
|
|
50005.00, '1/1/1988', 'CONTROLLER',
|
|
'ALICE IN WONDERLAND',
|
|
'UNIVERSITY OF ILLINOIS AT CHICAGO')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_mod_t_mid",
|
|
"Time for upd_mod_t_mid",
|
|
"update updates set col_key = '-5000'
|
|
where col_key = 5005"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_del_t_mid",
|
|
"Time for upd_del_t_mid",
|
|
"delete from updates
|
|
where (col_key='5005') or (col_key='-5000')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_app_t_end",
|
|
"Time for upd_app_t_end",
|
|
"delete from updates
|
|
where (col_key='5005') or (col_key='-5000')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_mod_t_end",
|
|
"Time for upd_mod_t_end",
|
|
"update updates
|
|
set col_key = -1000
|
|
where col_key = 1000000001"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_del_t_end",
|
|
"Time for upd_del_t_end",
|
|
"delete from updates where col_key = -1000"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_updates_code_h",
|
|
"time for create_idx_updates_code_h",
|
|
"create index updates_code_h on updates (col_code)",
|
|
$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_app_t_mid",
|
|
"Time for upd_app_t_mid",
|
|
"insert into updates
|
|
values (5005, 5005, 50005, 50005.00, 50005.00,
|
|
50005.00, '1/1/1988', 'CONTROLLER',
|
|
'ALICE IN WONDERLAND',
|
|
'UNIVERSITY OF ILLINOIS AT CHICAGO')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_mod_t_cod",
|
|
"Time for upd_mod_t_cod",
|
|
"update updates
|
|
set col_code = 'SQL+GROUPS'
|
|
where col_key = 5005"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_del_t_mid",
|
|
"Time for upd_del_t_mid",
|
|
"delete from updates
|
|
where (col_key='5005') or (col_key='-5000')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("create_idx_updates_int_bt",
|
|
"time for create_idx_updates_int_bt",
|
|
"create index updates_int_bt on updates (col_int)",
|
|
$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_app_t_mid",
|
|
"Time for upd_app_t_mid",
|
|
"insert into updates
|
|
values (5005, 5005, 50005, 50005.00, 50005.00,
|
|
50005.00, '1/1/1988', 'CONTROLLER',
|
|
'ALICE IN WONDERLAND',
|
|
'UNIVERSITY OF ILLINOIS AT CHICAGO')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_mod_t_int",
|
|
"Time for upd_mod_t_int",
|
|
"update updates set col_int = 50015 where col_key = 5005"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("upd_del_t_mid",
|
|
"Time for upd_del_t_mid",
|
|
"delete from updates
|
|
where (col_key='5005') or (col_key='-5000')"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("bulk_append",
|
|
"Time for bulk_append",
|
|
"insert into updates select * from saveupdates"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
test_command("bulk_delete",
|
|
"Time for bulk_delete",
|
|
"delete from updates where col_key < 0"
|
|
,$dbh,$opt_loop_count);
|
|
|
|
################################ END ###################################
|
|
####
|
|
#### End of the test...Finally print time used to execute the
|
|
#### whole test.
|
|
|
|
$dbh->disconnect;
|
|
|
|
end_benchmark($start_time);
|
|
|
|
############################ HELP FUNCTIONS ##############################
|
|
|
|
sub test_query
|
|
{
|
|
my($test_text,$result_text,$query,$dbh,$count)=@_;
|
|
my($i,$loop_time,$end_time);
|
|
|
|
print $test_text . "\n";
|
|
$loop_time=new Benchmark;
|
|
for ($i=0 ; $i < $count ; $i++)
|
|
{
|
|
defined(fetch_all_rows($dbh,$query)) or warn $DBI::errstr;
|
|
}
|
|
$end_time=new Benchmark;
|
|
print $result_text . "($count): " .
|
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
|
}
|
|
|
|
|
|
sub test_command
|
|
{
|
|
my($test_text,$result_text,$query,$dbh,$count)=@_;
|
|
my($i,$loop_time,$end_time);
|
|
|
|
print $test_text . "\n";
|
|
$loop_time=new Benchmark;
|
|
for ($i=0 ; $i < $count ; $i++)
|
|
{
|
|
$dbh->do($query) or die $DBI::errstr;
|
|
}
|
|
$end_time=new Benchmark;
|
|
print $result_text . "($count): " .
|
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
|
}
|
|
|
|
sub safe_command
|
|
{
|
|
my($test_text,$result_text,$query,$dbh,$count)=@_;
|
|
my($i,$loop_time,$end_time);
|
|
|
|
print $test_text . "\n";
|
|
$loop_time=new Benchmark;
|
|
for ($i=0 ; $i < $count ; $i++)
|
|
{
|
|
safe_do_many($dbh,$query);
|
|
}
|
|
$end_time=new Benchmark;
|
|
print $result_text . "($count): " .
|
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
|
}
|
|
|
|
sub test_many_command
|
|
{
|
|
my($test_text,$result_text,$query,$dbh,$count)=@_;
|
|
my($i,$loop_time,$end_time);
|
|
|
|
$loop_time=new Benchmark;
|
|
for ($i=0 ; $i < $count ; $i++)
|
|
{
|
|
safe_do_many($dbh, @$query);
|
|
}
|
|
$end_time=new Benchmark;
|
|
print $result_text . "($count): " .
|
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
|
}
|
|
|
|
|