MYCAT+MYSQL+JDBC implementation based on cell phone number tail storage and efficiency comparison
Key WordsCell phone Number Segmentation Mycat horizontal sub-table large data
test Environmentjdk1.7+mysql5.5+mycat1.5+myeclise10.7
Building a table to build a librarySet up four database a group: DB1, DB2, DB3;B Group: DB; The first three databases that belong to the Mycat operation, DB belong to different databases for. The user table is created in the above database, including ID, name, password, phone, post (cell phone tail);
DemandInsert 20 data, according to mobile phone tail, tail 0, 1, 2 deposit to Db1;3, 4, 5 deposit to DB2, other deposit to db3; DB deposits all cell phone numbers. Insert 20 data, the result requirements: 1: Comparison of Group A and Group B insertion time efficiency. In Group A and group B, insert 100w data to compare efficiency. Query the intermediate data according to the partition field, compare query efficiency. Do not check according to the partition field: Query intermediate data, compare query efficiency. Check for efficiency based on the partition field and not the partition field.
SQL
Sql
SET foreign_key_checks=0;
------------------------------
--table structure for ' user '
------------------------------
DROP table IF EXISTS ' user ';
CREATE TABLE ' user ' (
' id ' varchar (255) NOT NULL,
' name ' varchar (255) DEFAULT NULL,
' password ' varchar (255) D Efault null,
' phone ' varchar (255) default NULL,
' post ' varchar (255) default NULL,
PRIMARY KEY (' id '),
KEY ' id ' (' id ')
Engine=innodb DEFAULT Charset=utf8;
------------------------------
--Records of user
------------------------------
Test ResultsPartition succeeded; 20 data: Group A: Total time: 826ms;b Group: total length: 556ms;
Insert 20w Time: Group A: total length: 1231524ms; Group B: Direct crash, error reason: Message:no buffer space available (maximum connections reached?): Connect Insert 2w Time: A group: Total length: Total time: 116931ms; Group B: Total length: 105410ms
2w Data Query Intermediate data: Group A: Total time: 273ms;b Group: Total time: 258ms[Note: The query is based on the ID query, the partition field is post]
2w Data Query Intermediate data: Group A: Total time: Total length: 269;b Group: Total time: 503ms[Note: The query is based on the post query, the partition field is post]
2w Data Query Intermediate data: Group A: total length: 264ms; Group B: Total length: 280ms[Note: The query is based on post and mobile number query, the partition field is post] operation code "tested successfully"
http://download.csdn.net/detail/wgyscsf/9620006