MYSQL5.5 table partition question _ MySQL

Source: Internet
Author: User
MYSQL5.5 table partition problem bitsCN.com

Partitions in MYSQL5.5 tables

1. The field attribute is timestamp, and an exception occurs during partitioning.

Constant, random or timezone-dependent expressions in (sub) partitioning function are not allowed

I found it online. for example, if the timestamp type partition does not work, it should be changed to DATETIME or DATE.

Pruning is not expected to work for tables partitioned on a TIMESTAMP column, and you should use a DATETIME or DATE column for this instead.

2. if it is changed to datetime, the following error occurs:

A primary key must include all columns in the table's partitioning function

The mysql partition field must be included in the primary key.

The SQL statement is as follows:

Alter table Test partition by list (dayofweek (time) (PARTITION p01 values in (1), PARTITION p02 values in (2), PARTITION p03 values in (3 ), PARTITION p04 values in (4), PARTITION p05 values in (5), PARTITION p06 values in (6), PARTITION p07 values in (7 ), PARTITION perr values in (0 ));

BitsCN.com

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.