MySQL?????????????
???????????? ???????[ 2016/6/8 13:52:16 ] ????????????? MySQL
????????????
CREATE TABLE `happy_for_ni_labels` (
`id` int(11) NOT NULL AUTO_INCREMENT??
`name_chn` varchar(255) NOT NULL DEFAULT '0' COMMENT '?????????'??
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '?????'??
`xx_tag_id` int(11) NOT NULL DEFAULT '0' COMMENT '????XxTag#ID'??
`created_at` datetime NOT NULL??
`updated_at` datetime NOT NULL??
`xxxxx_tag_id` int(11) NOT NULL DEFAULT '0' COMMENT 'xxxxx_tags.id(?·??????)'??
PRIMARY KEY (`id`)??
KEY `idx_name_chn_with_id` (`name_chn`??`id`)??
KEY `idx_xx_tag_id_with_id` (`xx_tag_id`??`id`)??
KEY `idx_ptag_id` (`xxxxx_tag_id`??`id`)
) ENGINE=InnoDB AUTO_INCREMENT=719 DEFAULT CHARSET=utf8 COMMENT='?????????'
CREATE TABLE `happy_for_ni_label_links` (
`id` int(11) NOT NULL AUTO_INCREMENT??
`happy_for_ni_id` int(11) NOT NULL DEFAULT '0' COMMENT '????HappyForNi#ID'??
`checked_happy_for_ni_id` int(11) NOT NULL DEFAULT '0' COMMENT '????CheckedHappyForNi#ID'??
`label_id` int(11) NOT NULL DEFAULT '0' COMMENT '????HappyForNiLabel#ID'??
`status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '??????(???á????)'??
`created_at` datetime NOT NULL??
`updated_at` datetime NOT NULL??
PRIMARY KEY (`id`)??
KEY `idx_label_id_with_id` (`label_id`??`id`)??
KEY `idx_status_happy_for_ni_id_with_id` (`happy_for_ni_id`??`status`??`id`)??
KEY `idx_status_checked_happy_for_ni_id_with_id` (`checked_happy_for_ni_id`??`status`??`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2048836 DEFAULT CHARSET=utf8 COMMENT='???????????????'
??????в????????
explain SELECT `happy_for_ni_labels`.`id`
FROM `happy_for_ni_labels`
INNER JOIN `happy_for_ni_label_links`
ON `happy_for_ni_labels`.`id` = `happy_for_ni_label_links`.`label_id` WHERE `happy_for_ni_label_links`.`happy_for_ni_id` = 3369231
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: happy_for_ni_labels
type: index
possible_keys: PRIMARY
key: idx_xx_tag_id_with_id
key_len: 8
ref: NULL
rows: 461
Extra: Using index
*************************** 2. row ***************************
id: 1
select_type: SIMPLE
table: happy_for_ni_label_links
type: ref
possible_keys: idx_label_id_with_id
key: idx_label_id_with_id
key_len: 4
ref: my_local_test.happy_for_ni_labels.id
rows: 1872
Extra: Using WHERE
2 rows in set (0.00 sec)
ERROR:
No query specified
????????????? idx_status_happy_for_ni_id_with_id ??????????????? idx_label_id_with_id ???????????????????е??????
????????????????
??????????е?????????????????????
???????????????????????????
??????????????е?????????????????????
????mysql> SELECT count(id)?? status
????-> FROM happy_for_ni_label_links
????-> GROUP BY status;
????ERROR 2006 (HY000): MySQL server has gone away
????No connection. Trying to reconnect...
????Connection id: 112463
????Current database: my_local_test
????+-----------+--------+
????| count(id) | status |
????+-----------+--------+
????| 980377 | 0 |
????+-----------+--------+
????1 row in set (2.27 sec)
????status ???? 0 ???????????????????????????????????????????????????????????????????????????μ???????????????????status?????????????????????????0??????????????????????????????????????????飬????????з??????????λ??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11