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)06/01 Report--
This article is about how mysql creates partitions. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
# list partition-the key value determines which partition to write to through a custom list.
Advantages: support int, time, varchar etc.
Disadvantages: you need to write the subordinate of the corresponding data (write or query which partition), that is, if the partition condition is modified later, you need to reconfigure.
CREATE TABLE t_test (unid INT auto_increment, uuid VARCHAR (36), cdate datetime, type int, text varchar (30), PRIMARY KEY (unid,type)) PARTITION BY LIST COLUMNS (type) (# here is partitioned by the type field, in the list partition, this field can be int shaping or a value PARTITION pRegion_1 VALUES IN (1), # which means that when type=1 Data will be written to the pRegion_1 partition PARTITION pRegion_2 VALUES IN (2), # ditto PARTITION pRegion_3 VALUES IN (3), PARTITION pRegion_4 VALUES IN (4))
# hash partition-after the key value is calculated by the hash algorithm, it is automatically written to the corresponding partition.
Advantage: there is no need to write the subordinate of the corresponding data (write or query which partition)
Disadvantages: only int integers are supported
CREATE TABLE t_test (unid INT auto_increment, uuid VARCHAR (36), cdate datetime, type int, text varchar (30), PRIMARY KEY (unid,type) # compound primary key, because the type field will be used to partition) PARTITION BY HASH (type) # here, partitioned by the type field, type must be a primary key or a field contained in the compound primary key, and hash partitioning must be intPARTITIONS 10. # the number of partitions set here is 10, and the data will be automatically assigned to one of the 10 partitions after the hash algorithm through the type field. Thank you for reading! On how to establish mysql partition to share here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
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.