403Webshell
Server IP : 172.67.216.182  /  Your IP : 172.70.147.167
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/src/mysql-test/suite/ndb/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/src/mysql-test/suite/ndb/t/ndb_index_stat_partitions.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

-- source include/have_ndb.inc

set @is_enable_default = @@global.ndb_index_stat_enable;

set @is_enable = 1;
source ndb_index_stat_enable.inc;

create table record_in_range(no int primary key auto_increment,
query varchar(256), part_count int, 
explain_rows int, count_rows int) engine = myisam;

CREATE TABLE t1(
  K INT NOT NULL AUTO_INCREMENT,
  I INT,
  J INT,
  L INT,
  PRIMARY KEY(K),
  KEY(I,J),
  KEY(L)
) ENGINE=ndbcluster
  partition by key (K) partitions 1;

INSERT INTO t1(I,J,L) VALUES
(1,1,1),(2,2,2),(3,3,3),(4,4,4),(5,5,5),
(6,6,6),(7,7,7),(8,8,8),(9,9,9),(0,0,0);

INSERT INTO t1(I,J,L) SELECT I,1,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,2,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,3,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,4,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,5,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,6,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,7,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,8,I FROM t1 ORDER BY K;
INSERT INTO t1(I,J,L) SELECT I,9,I FROM t1 ORDER BY K;

select i, count(*) from t1 group by 1 order by 1;
select l, count(*) from t1 group by 1 order by 1;

ANALYZE TABLE t1;

--disable_query_log
let $i = 10;
let $p = 1;
while ($i)
{
  --let $q=SELECT count(*) as Count FROM t1 WHERE i = $i
  --let $explain_type= query_get_value(EXPLAIN $q, type, 1)
  --let $explain_rows= query_get_value(EXPLAIN $q, rows, 1)
  --let $count_rows= query_get_value($q, Count, 1)
  --eval insert into record_in_range(query,part_count,explain_rows,count_rows) values ('$q',$p,$explain_rows,$count_rows);
  dec $i;
}

let $l = 10;
while ($l)
{
  --let $q=SELECT count(*) as Count FROM t1 WHERE l = $l
  --let $explain_type= query_get_value(EXPLAIN $q, type, 1)
  --let $explain_rows= query_get_value(EXPLAIN $q, rows, 1)
  --let $count_rows= query_get_value($q, Count, 1)
  --eval insert into record_in_range(query,part_count,explain_rows,count_rows) values ('$q',$p,$explain_rows,$count_rows);
  dec $l;
}

alter table t1 partition by key() partitions 8;
analyze table t1;

let $p = 8;
let $i = 10;
while ($i)
{
  --let $q=SELECT count(*) as Count FROM t1 WHERE i = $i
  --let $explain_type= query_get_value(EXPLAIN $q, type, 1)
  --let $explain_rows= query_get_value(EXPLAIN $q, rows, 1)
  --let $count_rows= query_get_value($q, Count, 1)
  --eval insert into record_in_range(query,part_count,explain_rows,count_rows) values ('$q',$p,$explain_rows,$count_rows);
  dec $i;
}

let $l = 10;
while ($l)
{
  --let $q=SELECT count(*) as Count FROM t1 WHERE l = $l
  --let $explain_type= query_get_value(EXPLAIN $q, type, 1)
  --let $explain_rows= query_get_value(EXPLAIN $q, rows, 1)
  --let $count_rows= query_get_value($q, Count, 1)
  --eval insert into record_in_range(query,part_count,explain_rows,count_rows) values ('$q',$p,$explain_rows,$count_rows);
  dec $l;
}

--enable_query_log

# Change sql_mode to allow the reporting query below
# which uses "DISTINCT with an ORDER BY on column which
# is not in the select list"
--source include/turn_off_only_full_group_by.inc

select distinct 
       substring(rr.query from INSTR(rr.query, 'WHERE')) as 'WHERE', 
       count_rows, 
       p1.val as p1_val, 
       if(p8.err_pct is not null and abs(p8.err_pct)<45,'-',p8.val) p8_val,
       case when p1.err_pct is null then '-' when abs(p1.err_pct)<45 then '<45' else p1.err_pct end p1_err_pct,
       case when p8.err_pct is null then '-' when abs(p8.err_pct)<45 then '<45' else p8.err_pct end p8_err_pct
from record_in_range rr,
     (select query, explain_rows as val, if(count_rows>0,floor(100*(explain_rows - count_rows) / count_rows),NULL) err_pct
      from record_in_range p where part_count = 1) p1,
     (select query, explain_rows as val, if(count_rows>0,floor(100*(explain_rows - count_rows) / count_rows),NULL) err_pct
      from record_in_range p where part_count = 8) p8
where rr.query = p1.query
  and rr.query = p8.query
order by rr.no;

--source include/restore_sql_mode_after_turn_off_only_full_group_by.inc

DROP TABLE t1, record_in_range;

--echo End of 5.1 tests

set @is_enable = @is_enable_default;
source ndb_index_stat_enable.inc;

Youez - 2016 - github.com/yon3zu
LinuXploit