[Research on Schema attribute subTables of Mycat1.6]

1. Subtable configuration

<table name="demo"  dataNode="dn1" rule="mod-long"   subTables="t$1-3"/>


 



 

 

Problems configuring multiple DataNodes

 

Modify the modulo function to 1

 

The subtable does not exist and an error is reported

 

Because dn1 and dataNode are repeated, the next step is renamed t1, t2, t3


 

Renamed t1--t3

 

Insert three pieces of data into the demo data table to

 view the execution plan



 

 

Querying Demo, the result of the full query is wrong



 Exact query, the result is OK again

 

Remarks: Experimental script

CREATE TABLE `t1` (

  `uuid` int(11) NOT NULL AUTO_INCREMENT,

  `id` int(11) DEFAULT NULL,

  `address` varchar(20) DEFAULT NULL,

  PRIMARY KEY (`uuid`)

  

) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

 

 

EXPLAIN select * from demo where id=2

 

insert into demo(uuid,id,address) values(1,1,'1111');

insert into demo(uuid,id,address) values(2,2,'2222');

insert into demo(uuid,id,address) values(3,3,'33333');

 

CREATE TABLE `t1` (

  `uuid` int(11) NOT NULL AUTO_INCREMENT,

  `id` int(11) DEFAULT NULL,

  `address` varchar(20) DEFAULT NULL,

  PRIMARY KEY (`uuid`)

  

) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

 

CREATE TABLE `t2` (

  `uuid` int(11) NOT NULL AUTO_INCREMENT,

  `id` int(11) DEFAULT NULL,

  `address` varchar(20) DEFAULT NULL,

  PRIMARY KEY (`uuid`)

  

) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

 

CREATE TABLE `t3` (

  `uuid` int(11) NOT NULL AUTO_INCREMENT,

  `id` int(11) DEFAULT NULL,

  `address` varchar(20) DEFAULT NULL,

  PRIMARY KEY (`uuid`)

  

) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326456193&siteId=291194637