Tens data volume MySQL optimization strategy (i)

Source: Internet
Author: User

Table structure optimization 1. Using stand-alone table spaces

A stand-alone tablespace refers to a data structure of a InnoDB table

Exclusive tablespace: Each table will be generated in a separate file way for storage, each table has a. frm table description file, and an. ibd file. This file includes the data content of a single table and the index content, which, by default, is stored in the table's location.

2. Partition table

The partitioned table is a coarse-grained, easy-to-use indexing strategy for big data filtering scenarios. The most suitable scenario is when you do not have a suitable index, and you have a full table scan of several of the partitioned tables. or only one partition table and index are hotspots, And this partition and index can all be stored in memory. Limit the number of single-table partitions to no more than 150, and note that some of the details that cause partition filtering are not possible, and the partitioning table has no advantage over queries of individual records and needs to be aware of the performance of such queries.

Depending on the characteristics of the table structure, single table can be partitioned according to certain conditions, for example, if the data of a table is inserted in chronological order, then it can be partitioned according to the timestamp field.

3. In-Memory database

Consider storing data in an in-memory database to speed up data queries.

SQL Optimization 1. Enforce (ignore) index policies under multi-conditional queries

Force index

SELECT * from TABLE1 Force INDEX (FIELD1) ...

The above SQL statements use only the indexes built on FIELD1, not the indexes on other fields.

Ignore Indexes IGNORE Index

SELECT * from TABLE1 IGNORE INDEX (FIELD1, FIELD2) ...

In the above SQL statement, the indexes on FIELD1 and FIELD2 in the TABLE1 table are not used.

In conjunction with a partitioned table, the commonly enforced index is the partitioning criteria field for the partitioned table.

2. Minimize the association of tables use a single table for querying

If a table is associated with a large amount of data, the amount of Cartesian product that is generated is too large. The calculation of conditional filtering is time consuming.

Tens data volume MySQL optimization strategy (i)

Related Article

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.