???MySql SQL??????????
?????shamork ???????[ 2017/5/2 10:03:20 ] ????????MySQL ?????
???????????????inner join??sql ????????????????(0.1-0.2)????????д?????????????????????????????ζ?????????????????????????
????sql???£?
SELECT
p_item_token.*??
p_item.product_type
FROM
p_item_token
INNER JOIN p_item ON p_item.itemid = p_item_token.itemid
WHERE
p_item_token.token ='db87a780427d4d02ba2bd49fac8xxx';
???????б? p_item_token ?? itemid ???????? token ???????? p_item ??itemid ??????
?????????????????????0.03s????????????????0.2?????????????
??????? EXPLAIN ?????
1 EXPLAIN
2 SELECT
3 p_item_token.*??
4 p_item.product_type
5 FROM
6 p_item_token
7 INNER JOIN p_item ON p_item.itemid = p_item_token.itemid
8 WHERE
9 p_item_token.token = 'db87a780427d4d02ba2bd49fac8xxx';
?????????
??????????????p_item??????2w???????????????????????
??????????????
???????show warnings ???????????Щ?????SHOW WARNINGS ????н???????????????????????????????????С?
1 EXPLAIN
2 SELECT
3 p_item_token.*??
4 p_item.product_type
5 FROM
6 p_item_token
7 INNER JOIN p_item ON p_item.itemid = p_item_token.itemid
8 WHERE
9 p_item_token.token = 'db87a780427d4d02ba2bd49fac8xxx';
10
11 SHOW WARNINGS;
???????2???????code=1003.?????и?sql???????????mysql???????????sql???????????д?????е??????
1 /* select#1 */
2 SELECT
3 '0000eb612d78407a91a9b3854ffffffff' AS `itemid`?? /*?:??????????????????*/
4 'db87a780427d4d02ba2bd49fac8cf98b' AS `token`??
5 '2016-12-16 10:46:53' AS `create_time`??
6 '' AS `ftoken`??
7 `p_db`.`p_item`.`product_type` AS `product_type`
8 FROM
9 `p_db`.`p_item_token`
10 JOIN `p_db`.`p_item`
11 WHERE
12 (
13 (
14 CONVERT (
15 `p_db`.`p_item`.`itemid` USING utf8mb4
16 ) = '0000eb612d78407a91a9b3854fffffff'
17 )
18 )
??????????Where??????и? CONVERT ??????????????where?????У?????????????????????????????????????????????????????????????ò?????????????????????????????????????????????
??????????????????? itemid ????е????????? utf8mb4 .
??????????????е?????? utf8mb4 !
??????????????????У? itemid ????????????? utf8 ??????? utf8mb4 ??
???????????????????itemid????е???????utf8????????н????
????????????????????????????
???????????2?е????
1 /* select#1 */
2 SELECT
3 '0000eb612d78407a91a9b3854fffffff' AS `itemid`??
4 'db87a780427d4d02ba2bd49fac8cf98b' AS `token`??
5 '2016-12-16 10:46:53' AS `create_time`??
6 '' AS `ftoken`??
7 'cxx' AS `product_type`
8 FROM
9 `toy_item_plat`.`p_item_token`
10 JOIN `toy_item_plat`.`p_item`
11 WHERE
12 1
?????? select ?????????????????????
??????н??0.036s?????????
???????????:
????explain ???????м????????????????г???rows?????????????????????????裬???????????????
????show warning??????????????????????????????????????г??????????о???????????????
??????
???·???
??????????????????
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