In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "how to use the Mysql index", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use the Mysql index" this article.
Select.... From table where key_part1='xxx' and key_part3='yyy'
In this case, MYSQL can only process key_par1 in the index, but filter the condition of key_part3 in the index, unless select is followed by count (*)
This is the table structure of the last test:
CREATE TABLE `im_message_201005_21_ old` (
`msg_ id`bigint (20) NOT NULL default'0'
`time`datetime NOT NULL
`owner` varchar (64) NOT NULL
`other` varchar (64) NOT NULL
`content` varchar (8000) default NULL
PRIMARY KEY (`msg_ id`)
KEY `im_msg_own_oth_tim_ ind` (`owner`, `other`, `time`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin
What we are going to test this time is whether MYSQL can use the index correctly to filter invalid data with the condition of range field first.
First of all, let's adjust the order of the index: KEY `im_msg_own_tim_oth_ ind` (`owner`, `time`, `other`)
What we are going to test is how the index works when the where condition is: owner+time+other.
Why don't you come to a conclusion based on your own knowledge? )
I think most of the students think that the fields are the same and the index should work properly. Actually, it's not.
The key to this test is to see if mysql can filter the other field before returning to the table when the query condition is owner+time+other.
If it cannot be filtered, it will produce the same performance (logical read) as if the condition is owner+time.
Select count (distinct content) from im_message_201005_21_old
Where owner = 'cntaobaoytazy' and time > =' 2010-05-23 17-and time 14-23 'and time =' 2010-05-23 17-14-14-14-23 and time = '2010-05-23 17-14 14-23 14-23 and time =' 2010-05-23 17-14 and time 1423 'and time
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.