Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Ran the following
- alter table table_two add column `aincid` int unsigned PRIMARY KEY AUTO_INCREMENT first;
- alter table table_two modify `id` varchar(200) not null default 'unknownID';
- alter table table_one modify `id` varchar(200) not null; # added NOT NULL to table_one as well
- > show create table table_two
- CREATE TABLE `table_one` (
- `id` varchar(200) NOT NULL,
- `RecordKey` varchar(50) DEFAULT NULL,
- `VersionStat` varchar(200) DEFAULT NULL,
- `Status` varchar(200) DEFAULT NULL,
- `VersionNumber` varchar(50) DEFAULT NULL,
- `VersionDate` varchar(20) DEFAULT NULL,
- `PublishDate` varchar(20) DEFAULT NULL,
- `DistStart` varchar(20) DEFAULT NULL,
- `DistCommStat` varchar(2000) DEFAULT NULL,
- `BrandName` varchar(100) DEFAULT NULL,
- `VersionModelNumber` varchar(100) DEFAULT NULL,
- `Catalog` varchar(100) DEFAULT NULL,
- `dwNumber` varchar(100) DEFAULT NULL,
- `CompanyName` varchar(500) DEFAULT NULL,
- `DeviceCount` varchar(200) DEFAULT NULL,
- `description` varchar(3000) DEFAULT NULL,
- `Exemption` varchar(1100) DEFAULT NULL,
- `PreMarket` varchar(1500) DEFAULT NULL,
- `DevDRMT` varchar(1000) DEFAULT NULL,
- `DTKit` varchar(200) DEFAULT NULL,
- `Combination` varchar(250) DEFAULT NULL,
- `Usage` varchar(500) DEFAULT NULL,
- `SingleBatch` varchar(50) DEFAULT NULL,
- `SerialNumber` varchar(250) DEFAULT NULL,
- `ManuDate` varchar(20) DEFAULT NULL,
- `ExpDate` varchar(20) DEFAULT NULL,
- `Donation` varchar(50) DEFAULT NULL,
- `LabeldWithMLO` varchar(50) DEFAULT NULL,
- `NLabledMLO` varchar(50) DEFAULT NULL,
- `MLOStatus` varchar(1000) DEFAULT NULL,
- `BTT` varchar(50) DEFAULT NULL,
- `OPP` varchar(50) DEFAULT NULL,
- `BRC` varchar(50) DEFAULT NULL,
- `PriorUse` varchar(100) DEFAULT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1
- > show create table table_two
- CREATE TABLE `table_two` (
- `aincid` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `id` varchar(200) NOT NULL DEFAULT 'unknownID',
- `Name` varchar(200) DEFAULT NULL,
- `deviceType` varchar(50) DEFAULT NULL,
- `issuedBy` varchar(200) DEFAULT NULL,
- `avNum` varchar(50) DEFAULT NULL,
- `quant` varchar(50) DEFAULT NULL,
- `discDate` varchar(50) DEFAULT NULL,
- `PkgStatus` varchar(50) DEFAULT NULL,
- `Type` varchar(50) DEFAULT NULL,
- PRIMARY KEY (`aincid`),
- KEY `idx_table_two_id` (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2457646 DEFAULT CHARSET=latin1
- > explain SELECT SQL_NO_CACHE DISTINCT ...
- ******************** 1. row *********************
- id: 1
- select_type: SIMPLE
- table: d
- partitions:
- type: ALL
- possible_keys: PRIMARY
- key:
- key_len:
- ref:
- rows: 1894942
- filtered: 100.00
- Extra: Using temporary
- ******************** 2. row *********************
- id: 1
- select_type: SIMPLE
- table: i
- partitions:
- type: ref
- possible_keys: idx_table_two_id
- key: idx_table_two_id
- key_len: 202
- ref: mydb.d.id
- rows: 1
- filtered: 100.00
- Extra:
- ###############
- # 5.7 indexes
- ###############
- > SHOW INDEX FROM table_one
- ******************** 1. row *********************
- Table: table_one
- Non_unique: 0
- Key_name: PRIMARY
- Seq_in_index: 1
- Column_name: id
- Collation: A
- Cardinality: 1894942
- Sub_part:
- Packed:
- Null:
- Index_type: BTREE
- Comment:
- Index_comment:
- 1 rows in set
- > SHOW INDEX FROM table_two
- ******************** 1. row *********************
- Table: table_two
- Non_unique: 0
- Key_name: PRIMARY
- Seq_in_index: 1
- Column_name: aincid
- Collation: A
- Cardinality: 2477600
- Sub_part:
- Packed:
- Null:
- Index_type: BTREE
- Comment:
- Index_comment:
- ******************** 2. row *********************
- Table: table_two
- Non_unique: 1
- Key_name: idx_table_two_id
- Seq_in_index: 1
- Column_name: id
- Collation: A
- Cardinality: 2116953
- Sub_part:
- Packed:
- Null:
- Index_type: BTREE
- Comment:
- Index_comment:
- 2 rows in set
- ###############
- # 5.6 indexes
- ###############
- > SHOW INDEX FROM table_one
- ******************** 1. row *********************
- Table: table_one
- Non_unique: 0
- Key_name: PRIMARY
- Seq_in_index: 1
- Column_name: id
- Collation: A
- Cardinality: 1596593
- Sub_part:
- Packed:
- Null:
- Index_type: BTREE
- Comment:
- Index_comment:
- 1 rows in set
- > SHOW INDEX FROM table_two
- ******************** 1. row *********************
- Table: table_two
- Non_unique: 1
- Key_name: idx_table_two_id
- Seq_in_index: 1
- Column_name: id
- Collation: A
- Cardinality: 2384739
- Sub_part:
- Packed:
- Null: YES
- Index_type: BTREE
- Comment:
- Index_comment:
- 1 rows in set
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement