Mysql table sharding

Source: Internet
Author: User
This is related to mysql table sharding. my table has 230 fields (the content is not much, and there are less than 20 thousand records), which has a huge impact on the web browsing speed. Recently, we have considered table sharding, my understanding of table Sharding is to split many fields in a table into two or more tables. However, I see a lot of information on the internet. table Sharding is not a sharding field, but related to mysql table sharding.
In this case, my table has 230 fields (the content is not much, less than 20 thousand records), which has a huge impact on the web browsing speed. Recently, we have considered table sharding,
My understanding of table Sharding is to split many fields in a table into two or more tables.
However, I have seen a lot of data on the internet. table sharding does not split fields, but splits the content in the table.

Do you guys tell me that my understanding is wrong?

------ Solution --------------------
Sofa top
------ Solution --------------------
In fact, there is no conflict between the two methods, depending on the actual situation.

If the content in the table can be classified, such as the data of the current day and historical data, the table is partitioned based on the content.

If it is a clear one-to-one or one-to-multiple structure, you can use relational data.

Don't be surprised
------ Solution --------------------
Discussion
In this case, my table has 230 fields (the content is not much, less than 20 thousand records), which has a huge impact on the web browsing speed. Recently, we have considered table sharding,
My understanding of table Sharding is to split many fields in a table into two or more tables.
However, I have seen a lot of data on the internet. table sharding does not split fields, but splits the content in the table.

Do you guys tell me that my understanding is wrong?

------ Solution --------------------
Table Sharding is generally based on the content, based on the date and id segment .. For table sharding, the SQL statement on the business side must be modified accordingly.
A table has 230 fields .. Is there a serious problem with the design?
------ Solution --------------------
1. if a table Shard has a horizontal score (by field) or a vertical score (by record), it doesn't matter. just do it.

2.230 fields, more than 20 thousand records are not big, it is best to carefully test and analyze, find the specific cause of the problem (such as whether it is caused by an individual SQL), find the specific cause, modifying the database structure is also more advanced. if the reason is not clear, the modification may not take effect.

3. data like you
We often use the following structures:
Id modelId attributeId value
1 111 2233 3028

(111-> BMW 5 Series 520Li, 2233-> wheelbase)

This method has a large number of records, but the structure is simple. in addition, it is easy to increase and reduce attribute values (many of these configuration data are provided by different manufacturers, and may not be enough in the future after 230 .)

Our company also has a website for cars and motorcycles. The data is in this way for reference.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.