CREATE TABLE t1 ( a char(10) CHARSET latin1 NOT NULL, e varbinary(3000) not null, b int, c blob, d varbinary(26000), primary key(e,a), unique key (b) ) comment='NDB_TABLE=FULLY_REPLICATED=1' ENGINE=ndbcluster; use ndbinfo; select tab_partitions, tab_fragments from table_distribution_status as tds join dict_obj_info as doi where tds.table_id = doi.id and doi.fq_name = 'test/def/t1'; tab_partitions tab_fragments 8 8 select partition_id, fragment_id, partition_order, log_part_id, preferred_primary from table_fragments as tf join dict_obj_info as doi where tf.table_id = doi.id and doi.fq_name = 'test/def/t1' order by fragment_id; partition_id fragment_id partition_order log_part_id preferred_primary 0 0 0 0 1 1 1 0 1 2 2 2 0 2 1 3 3 0 3 2 4 4 0 0 2 5 5 0 1 1 6 6 0 2 2 7 7 0 3 1 select fragment_id, replica_node_id from table_replicas as tr join dict_obj_info as doi where tr.table_id = doi.id and doi.fq_name = 'test/def/t1' order by fragment_id, replica_node_id; fragment_id replica_node_id 0 1 0 2 1 1 1 2 2 1 2 2 3 1 3 2 4 1 4 2 5 1 5 2 6 1 6 2 7 1 7 2 select read_backup, fully_replicated from table_info as ti join dict_obj_info as doi where ti.table_id = doi.id and doi.fq_name = 'test/def/t1'; read_backup fully_replicated 1 1 use test; insert into t1 values ('24', REPEAT('1', 3000), 24, REPEAT('24', 3000), REPEAT('A', 26000)); insert into t1 values ('23', REPEAT('1', 3000), 23, REPEAT('23', 3000), REPEAT('A', 26000)); insert into t1 values ('22', REPEAT('1', 3000), 22, REPEAT('22', 3000), REPEAT('A', 26000)); insert into t1 values ('21', REPEAT('1', 3000), 21, REPEAT('21', 3000), REPEAT('A', 26000)); insert into t1 values ('20', REPEAT('1', 3000), 20, REPEAT('20', 3000), REPEAT('A', 26000)); insert into t1 values ('19', REPEAT('1', 3000), 19, REPEAT('19', 3000), REPEAT('A', 26000)); insert into t1 values ('18', REPEAT('1', 3000), 18, REPEAT('18', 3000), REPEAT('A', 26000)); insert into t1 values ('17', REPEAT('1', 3000), 17, REPEAT('17', 3000), REPEAT('A', 26000)); insert into t1 values ('16', REPEAT('1', 3000), 16, REPEAT('16', 3000), REPEAT('A', 26000)); insert into t1 values ('15', REPEAT('1', 3000), 15, REPEAT('15', 3000), REPEAT('A', 26000)); insert into t1 values ('14', REPEAT('1', 3000), 14, REPEAT('14', 3000), REPEAT('A', 26000)); insert into t1 values ('13', REPEAT('1', 3000), 13, REPEAT('13', 3000), REPEAT('A', 26000)); insert into t1 values ('12', REPEAT('1', 3000), 12, REPEAT('12', 3000), REPEAT('A', 26000)); insert into t1 values ('11', REPEAT('1', 3000), 11, REPEAT('11', 3000), REPEAT('A', 26000)); insert into t1 values ('10', REPEAT('1', 3000), 10, REPEAT('10', 3000), REPEAT('A', 26000)); insert into t1 values ('9', REPEAT('1', 3000), 9, REPEAT('9', 3000), REPEAT('A', 26000)); insert into t1 values ('8', REPEAT('1', 3000), 8, REPEAT('8', 3000), REPEAT('A', 26000)); insert into t1 values ('7', REPEAT('1', 3000), 7, REPEAT('7', 3000), REPEAT('A', 26000)); insert into t1 values ('6', REPEAT('1', 3000), 6, REPEAT('6', 3000), REPEAT('A', 26000)); insert into t1 values ('5', REPEAT('1', 3000), 5, REPEAT('5', 3000), REPEAT('A', 26000)); insert into t1 values ('4', REPEAT('1', 3000), 4, REPEAT('4', 3000), REPEAT('A', 26000)); insert into t1 values ('3', REPEAT('1', 3000), 3, REPEAT('3', 3000), REPEAT('A', 26000)); insert into t1 values ('2', REPEAT('1', 3000), 2, REPEAT('2', 3000), REPEAT('A', 26000)); insert into t1 values ('1', REPEAT('1', 3000), 1, REPEAT('1', 3000), REPEAT('A', 26000)); create temporary table t1_frag_size ( fragment_num int primary key, fixed_elem_count int ); insert into t1_frag_size select fragment_num, fixed_elem_count from `ndbinfo`.`memory_per_fragment` where fq_name = 'test/def/t1' and node_id = 1; set @numpart = (select count(*) from t1_frag_size); select mpf.node_id, mpf.fragment_num, mpf.fixed_elem_count, tfs.fragment_num, tfs.fixed_elem_count from `ndbinfo`.`memory_per_fragment` mpf join t1_frag_size tfs on tfs.fragment_num = mpf.fragment_num mod @numpart where mpf.fq_name = 'test/def/t1' and mpf.fixed_elem_count <> tfs.fixed_elem_count order by tfs.fragment_num, mpf.node_id, mpf.fragment_num; node_id fragment_num fixed_elem_count fragment_num fixed_elem_count create temporary table counters_at_startup select counter_name, sum(val) as val from ndbinfo.counters group by counter_name; select a,b,LENGTH(c) from t1 where a = '1' and e = REPEAT('1', 3000); a b LENGTH(c) 1 1 3000 select a,b,LENGTH(c) from t1 where a = '2' and e = REPEAT('1', 3000); a b LENGTH(c) 2 2 3000 select a,b,LENGTH(c) from t1 where a = '3' and e = REPEAT('1', 3000); a b LENGTH(c) 3 3 3000 select a,b,LENGTH(c) from t1 where a = '4' and e = REPEAT('1', 3000); a b LENGTH(c) 4 4 3000 select a,b,LENGTH(c) from t1 where a = '5' and e = REPEAT('1', 3000); a b LENGTH(c) 5 5 3000 select a,b,LENGTH(c) from t1 where a = '6' and e = REPEAT('1', 3000); a b LENGTH(c) 6 6 3000 select a,b,LENGTH(c) from t1 where a = '7' and e = REPEAT('1', 3000); a b LENGTH(c) 7 7 3000 select a,b,LENGTH(c) from t1 where a = '8' and e = REPEAT('1', 3000); a b LENGTH(c) 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('1', '2', '3', '4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 1 1 3000 2 2 3000 3 3 3000 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('2', '3', '4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 2 2 3000 3 3 3000 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('3', '4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 3 3 3000 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 7 7 3000 8 8 3000 select s1.counter_name, s2.val - s1.val as diff from counters_at_startup s1, (select counter_name, sum(val) as val from ndbinfo.counters group by counter_name) s2 where s1.counter_name = s2.counter_name and ( s1.counter_name = 'LOCAL_READS' or s1.counter_name = 'READS' ) order by 1; counter_name diff LOCAL_READS 131 READS 131 drop table counters_at_startup; output_line -- t1 -- Table options: readbackup, fullyreplicated -- Attributes -- -- NDB$BLOB_#_# -- Table options: readbackup, fullyreplicated -- Attributes -- Creating nodegroup alter table t1 algorithm=inplace, reorganize partition; use ndbinfo; select tab_partitions, tab_fragments from table_distribution_status as tds join dict_obj_info as doi where tds.table_id = doi.id and doi.fq_name = 'test/def/t1'; tab_partitions tab_fragments 8 16 select partition_id, fragment_id, log_part_id, partition_order, preferred_primary from table_fragments as tf join dict_obj_info as doi where tf.table_id = doi.id and doi.fq_name = 'test/def/t1' order by fragment_id; partition_id fragment_id log_part_id partition_order preferred_primary 0 0 0 0 1 1 1 1 0 2 2 2 2 0 1 3 3 3 0 2 4 4 0 0 2 5 5 1 0 1 6 6 2 0 2 7 7 3 0 1 0 8 0 1 3 1 9 1 1 4 2 10 2 1 3 3 11 3 1 4 4 12 0 1 4 5 13 1 1 3 6 14 2 1 4 7 15 3 1 3 select fragment_id, replica_node_id from table_replicas as tr join dict_obj_info as doi where tr.table_id = doi.id and doi.fq_name = 'test/def/t1' order by fragment_id, replica_node_id; fragment_id replica_node_id 0 1 0 2 1 1 1 2 2 1 2 2 3 1 3 2 4 1 4 2 5 1 5 2 6 1 6 2 7 1 7 2 8 3 8 4 9 3 9 4 10 3 10 4 11 3 11 4 12 3 12 4 13 3 13 4 14 3 14 4 15 3 15 4 use test; set global ndb_data_node_neighbour = 1; create table c as select node_id, fragment_num, tot_frag_scans from `ndbinfo`.`operations_per_fragment` where fq_name = 'test/def/t1'; select count(*) from t1; count(*) 24 select distinct o.node_id from `ndbinfo`.`operations_per_fragment` o join c on o.node_id = c.node_id and o.fragment_num = c.fragment_num where fq_name = 'test/def/t1' and o.tot_frag_scans > c.tot_frag_scans; node_id 1 drop table c; set global ndb_data_node_neighbour = 2; create table c as select node_id, fragment_num, tot_frag_scans from `ndbinfo`.`operations_per_fragment` where fq_name = 'test/def/t1'; select count(*) from t1; count(*) 24 select distinct o.node_id from `ndbinfo`.`operations_per_fragment` o join c on o.node_id = c.node_id and o.fragment_num = c.fragment_num where fq_name = 'test/def/t1' and o.tot_frag_scans > c.tot_frag_scans; node_id 2 drop table c; set global ndb_data_node_neighbour = 3; create table c as select node_id, fragment_num, tot_frag_scans from `ndbinfo`.`operations_per_fragment` where fq_name = 'test/def/t1'; select a,b,LENGTH(c) from t1 where a = 1; a b LENGTH(c) 1 1 3000 select distinct o.node_id from `ndbinfo`.`operations_per_fragment` o join c on o.node_id = c.node_id and o.fragment_num = c.fragment_num where fq_name = 'test/def/t1' and o.tot_frag_scans > c.tot_frag_scans; node_id 3 drop table c; set global ndb_data_node_neighbour = 4; create table c as select node_id, fragment_num, tot_frag_scans from `ndbinfo`.`operations_per_fragment` where fq_name = 'test/def/t1'; select a,b,LENGTH(c) from t1; a b LENGTH(c) 1 1 3000 10 10 6000 11 11 6000 12 12 6000 13 13 6000 14 14 6000 15 15 6000 16 16 6000 17 17 6000 18 18 6000 19 19 6000 2 2 3000 20 20 6000 21 21 6000 22 22 6000 23 23 6000 24 24 6000 3 3 3000 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 9 9 3000 select distinct o.node_id from `ndbinfo`.`operations_per_fragment` o join c on o.node_id = c.node_id and o.fragment_num = c.fragment_num where fq_name = 'test/def/t1' and o.tot_frag_scans > c.tot_frag_scans; node_id 4 drop table c; set global ndb_data_node_neighbour = 0; select mpf.node_id, mpf.fragment_num, mpf.fixed_elem_count, tfs.fragment_num, tfs.fixed_elem_count from `ndbinfo`.`memory_per_fragment` mpf join t1_frag_size tfs on tfs.fragment_num = mpf.fragment_num mod @numpart where mpf.fq_name = 'test/def/t1' and mpf.fixed_elem_count <> tfs.fixed_elem_count order by tfs.fragment_num, mpf.node_id, mpf.fragment_num; node_id fragment_num fixed_elem_count fragment_num fixed_elem_count create temporary table counters_at_startup select counter_name, sum(val) as val from ndbinfo.counters group by counter_name; select a,b,LENGTH(c) from t1 where a = '1' and e = REPEAT('1', 3000); a b LENGTH(c) 1 1 3000 select a,b,LENGTH(c) from t1 where a = '2' and e = REPEAT('1', 3000); a b LENGTH(c) 2 2 3000 select a,b,LENGTH(c) from t1 where a = '3' and e = REPEAT('1', 3000); a b LENGTH(c) 3 3 3000 select a,b,LENGTH(c) from t1 where a = '4' and e = REPEAT('1', 3000); a b LENGTH(c) 4 4 3000 select a,b,LENGTH(c) from t1 where a = '5' and e = REPEAT('1', 3000); a b LENGTH(c) 5 5 3000 select a,b,LENGTH(c) from t1 where a = '6' and e = REPEAT('1', 3000); a b LENGTH(c) 6 6 3000 select a,b,LENGTH(c) from t1 where a = '7' and e = REPEAT('1', 3000); a b LENGTH(c) 7 7 3000 select a,b,LENGTH(c) from t1 where a = '8' and e = REPEAT('1', 3000); a b LENGTH(c) 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('1', '2', '3', '4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 1 1 3000 2 2 3000 3 3 3000 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('2', '3', '4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 2 2 3000 3 3 3000 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('3', '4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 3 3 3000 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('4', '5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 4 4 3000 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('5', '6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 5 5 3000 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('6', '7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 6 6 3000 7 7 3000 8 8 3000 select a,b,LENGTH(c) from t1 where a in ('7', '8') and e = REPEAT('1', 3000); a b LENGTH(c) 7 7 3000 8 8 3000 select s1.counter_name, s2.val - s1.val as diff from counters_at_startup s1, (select counter_name, sum(val) as val from ndbinfo.counters group by counter_name) s2 where s1.counter_name = s2.counter_name and ( s1.counter_name = 'LOCAL_READS' or s1.counter_name = 'READS' ) order by 1; counter_name diff LOCAL_READS 129 READS 129 drop table counters_at_startup; select mpf.node_id, mpf.fragment_num, mpf.fixed_elem_count, tfs.fragment_num, tfs.fixed_elem_count from `ndbinfo`.`memory_per_fragment` mpf join t1_frag_size tfs on tfs.fragment_num = mpf.fragment_num mod @numpart where mpf.fq_name = 'test/def/t1' and mpf.fixed_elem_count <> tfs.fixed_elem_count order by tfs.fragment_num, mpf.node_id, mpf.fragment_num; node_id fragment_num fixed_elem_count fragment_num fixed_elem_count output_line -- t1 -- Table options: readbackup, fullyreplicated -- Attributes -- -- NDB$BLOB_#_# -- Table options: readbackup, fullyreplicated -- Attributes -- Creating nodegroup Creating nodegroup alter table t1 algorithm=inplace, reorganize partition; use ndbinfo; select tab_partitions, tab_fragments from table_distribution_status as tds join dict_obj_info as doi where tds.table_id = doi.id and doi.fq_name = 'test/def/t1'; tab_partitions tab_fragments 8 32 select partition_id, fragment_id, partition_order, log_part_id, preferred_primary from table_fragments as tf join dict_obj_info as doi where tf.table_id = doi.id and doi.fq_name = 'test/def/t1' order by fragment_id; partition_id fragment_id partition_order log_part_id preferred_primary 0 0 0 0 1 1 1 0 1 2 2 2 0 2 1 3 3 0 3 2 4 4 0 0 2 5 5 0 1 1 6 6 0 2 2 7 7 0 3 1 0 8 1 0 3 1 9 1 1 4 2 10 1 2 3 3 11 1 3 4 4 12 1 0 4 5 13 1 1 3 6 14 1 2 4 7 15 1 3 3 0 16 2 0 5 1 17 2 1 6 2 18 2 2 5 3 19 2 3 6 4 20 2 0 6 5 21 2 1 5 6 22 2 2 6 7 23 2 3 5 0 24 3 3 8 1 25 3 0 7 2 26 3 1 8 3 27 3 2 7 4 28 3 3 7 5 29 3 0 8 6 30 3 1 7 7 31 3 2 8 select fragment_id, replica_node_id from table_replicas as tr join dict_obj_info as doi where tr.table_id = doi.id and doi.fq_name = 'test/def/t1' order by fragment_id, replica_node_id; fragment_id replica_node_id 0 1 0 2 1 1 1 2 2 1 2 2 3 1 3 2 4 1 4 2 5 1 5 2 6 1 6 2 7 1 7 2 8 3 8 4 9 3 9 4 10 3 10 4 11 3 11 4 12 3 12 4 13 3 13 4 14 3 14 4 15 3 15 4 16 5 16 6 17 5 17 6 18 5 18 6 19 5 19 6 20 5 20 6 21 5 21 6 22 5 22 6 23 5 23 6 24 7 24 8 25 7 25 8 26 7 26 8 27 7 27 8 28 7 28 8 29 7 29 8 30 7 30 8 31 7 31 8 use test; select mpf.node_id, mpf.fragment_num, mpf.fixed_elem_count, tfs.fragment_num, tfs.fixed_elem_count from `ndbinfo`.`memory_per_fragment` mpf join t1_frag_size tfs on tfs.fragment_num = mpf.fragment_num mod @numpart where mpf.fq_name = 'test/def/t1' and mpf.fixed_elem_count <> tfs.fixed_elem_count order by tfs.fragment_num, mpf.node_id, mpf.fragment_num; node_id fragment_num fixed_elem_count fragment_num fixed_elem_count drop table t1;