config root man

Current Path : /home/usr.opt/mysql57/mysql-test/t/

FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64
Upload File :
Current File : //home/usr.opt/mysql57/mysql-test/t/eq_range_idx_stat.test

# The include statement below is a temp one for tests that are yet to
#be ported to run with InnoDB,
#but needs to be kept for tests that would need MyISAM in future.
--source include/force_myisam_default.inc

# Tests for eq_range_index_dive_limit variable: 
#   test that index dives are not done when index 
#   statistics is requested

--source include/have_debug.inc

SET eq_range_index_dive_limit=default;
SELECT @@eq_range_index_dive_limit;

CREATE TABLE t1
(
  /* Field names reflect value(rowid) distribution, st=STairs, swt= SaWTooth */
  st_a int,
  swt1a int,
  swt2a int,

  st_b int,
  swt1b int,
  swt2b int,

  key sta_swt12a(st_a,swt1a,swt2a),
  key sta_swt1a(st_a,swt1a),
  key sta_swt2a(st_a,swt2a),
  key sta_swt21a(st_a,swt2a,swt1a),

  key st_a(st_a),
  key stb_swt1a_2b(st_b,swt1b,swt2a),
  key stb_swt1b(st_b,swt1b),
  key st_b(st_b)
) ;

ALTER TABLE t1 DISABLE KEYS;

--disable_query_log
--echo #
--echo # Printing of many insert into t1 disabled.
--echo #
let $1=3;
while ($1)
{
  let $2=3;
  while ($2)
  {
    let $3=3;
    while ($3)
    {
      let $equal_records=30;
      while ($equal_records)
      {
        eval insert into t1 select $1, $2, $3, $1 ,$2, $3;
        dec $equal_records;
      }
      dec $3;
    }
    dec $2;
  }
 dec $1;
}
--enable_query_log
ALTER TABLE t1 ENABLE KEYS;
ANALYZE TABLE t1;

--echo #
--echo # Run index_merge queries two times: 1) with index dives
--echo #                                    2) with index statistics
--echo #
let $iterations=2;
while ($iterations)
{
  dec $iterations;

  --echo
  explain 
  select * from t1 
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;

  select * from t1 
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 and swt2b=1 limit 5;

  --echo
  explain 
  select * from t1
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;

  select * from t1
  where st_a=1 and swt1a=1 and swt2a=1 and st_b=1 and swt1b=1 limit 5;

  --echo
  explain 
  select * from t1
  where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;

  select * from t1
  where st_a=1 and swt1a=1 and st_b=1 and swt1b=1 and swt1b=1 limit 5;

  --echo
  SET eq_range_index_dive_limit=1;
  SET SESSION DEBUG="+d,crash_records_in_range";
}

DROP TABLE t1;

Man Man