In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The data of the character type does not use quotation marks, and the index will be suppressed. Here is an example:
View the table structure:
Click (here) to collapse or open
Mysql > show create table test06\ G
* * 1. Row *
Table: test06
Create Table: CREATE TABLE `test06` (
`id`bigint (11) NOT NULL DEFAULT'0'
`u_ id` bigint (11) NOT NULL
`openid` varchar (100) DEFAULT NULL
`unionid` varchar (100) DEFAULT NULL
`username` varchar (100) NOT NULL
`password` varchar (100) NOT NULL
`create_ time`datetime NOT NULL
KEY `idx_test03_ id` (`id`)
KEY `idx_test03_ name` (`username`)
KEY `idx_test06_crea_ time` (`create_ time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
1 row in set (0.00 sec) username field without quotation marks:
Click (here) to collapse or open
Mysql > select * from test06 where username=13499770088
Empty set, 8208 warnings (5.77 sec)
Mysql > explain select * from test06 where username=13499770088
+-- +
| | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+-- +
| | 1 | SIMPLE | test06 | ALL | idx_test03_name | NULL | NULL | NULL | 2009559 | Using where |
+-+ username field in quotation marks:
Click (here) to collapse or open
Mysql > select * from test06 where username='13499770088'
Empty set (0.07 sec)
Mysql > explain select * from test06 where username='13499770088'
+-+-
| | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+-+-
| | 1 | SIMPLE | test06 | ref | idx_test03_name | idx_test03_name | 302 | const | 1 | Using index condition |
The query speed of +-+ is obviously faster. The execution plan is indexed, which is the normal way to write.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.