zoukankan      html  css  js  c++  java
  • 分区实践 A PRIMARY KEY must include all columns in the table's partitioning function

    MySQL :: MySQL 8.0 Reference Manual :: 23 Partitioning https://dev.mysql.com/doc/refman/8.0/en/partitioning.html

    【仅支持  InnoDB and NDB 

    In MySQL 8.0, partitioning support is provided by the InnoDB and NDB storage engines.

    MySQL 8.0 does not currently support partitioning of tables using any storage engine other than InnoDB or NDB, such as MyISAM. An attempt to create a partitioned tables using a storage engine that does not supply native partitioning support fails with ER_CHECK_NOT_IMPLEMENTED.

    MySQL 8.0 Community binaries provided by Oracle include partitioning support provided by the InnoDB and NDB storage engines. For information about partitioning support offered in MySQL Enterprise Edition binaries, see Chapter 30, MySQL Enterprise Edition.

    If you are compiling MySQL 8.0 from source, configuring the build with InnoDB support is sufficient to produce binaries with partition support for InnoDB tables. For more information, see Section 2.9, “Installing MySQL from Source”.

    Nothing further needs to be done to enable partitioning support by InnoDB (for example, no special entries are required in the my.cnf file).

    It is not possible to disable partitioning support by the InnoDB storage engine.

    MySQL :: MySQL 8.0 Reference Manual :: 23.1 Overview of Partitioning in MySQL https://dev.mysql.com/doc/refman/8.0/en/partitioning-overview.html

    【不同的分区,按照不同的表存储】

    Partitioning takes this notion a step further, by enabling you to distribute portions of individual tables across a file system according to rules which you can set largely as needed. In effect, different portions of a table are stored as separate tables in different locations. The user-selected rule by which the division of data is accomplished is known as a partitioning function, which in MySQL can be the modulus, simple matching against a set of ranges or value lists, an internal hashing function, or a linear hashing function. The function is selected according to the partitioning type specified by the user, and takes as its parameter the value of a user-supplied expression. This expression can be a column value, a function acting on one or more column values, or a set of one or more column values, depending on the type of partitioning that is used.

    【分区类型 】

    可以隐式按照日期分区

    MySQL :: MySQL 8.0 Reference Manual :: 23.2 Partitioning Types https://dev.mysql.com/doc/refman/8.0/en/partitioning-types.html

    A very common use of database partitioning is to segregate data by date. Some database systems support explicit date partitioning, which MySQL does not implement in 8.0. However, it is not difficult in MySQL to create partitioning schemes based on DATETIME, or DATETIME columns, or based on expressions making use of such columns.

    When partitioning by KEY or LINEAR KEY, you can use a DATETIME, or DATETIME column as the partitioning column without performing any modification of the column value. For example, this table creation statement is perfectly valid in MySQL:

    CREATE TABLE members (
        firstname VARCHAR(25) NOT NULL,
        lastname VARCHAR(25) NOT NULL,
        username VARCHAR(16) NOT NULL,
        email VARCHAR(35),
        joined DATE NOT NULL
    )
    PARTITION BY KEY(joined)
    PARTITIONS 6;

    In MySQL 8.0, it is also possible to use a DATE or DATETIME column as the partitioning column using RANGE COLUMNS and LIST COLUMNS partitioning.

    A PRIMARY KEY must include all columns in the table's partitioning function

    DROP TABLE IF EXISTS page_last_visitor;
    受影响的行: 0
    时间: 0.056s
    
    [SQL]
     CREATE TABLE `page_last_visitor` (
      `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
      `uid` int(11) NOT NULL DEFAULT 0 COMMENT '广告主ID',
      `address` varchar(1024) NOT NULL DEFAULT '' COMMENT '广告详情页',
      `pv` int(11) NOT NULL DEFAULT 0 COMMENT '日浏览总量',
      `ip` bigint(20) NOT NULL DEFAULT 0 COMMENT '访客最后访问ip',
      `date` int(11) NOT NULL DEFAULT 0 COMMENT '日期',
      `modify_time` int(11) NOT NULL DEFAULT 0 COMMENT '最后更新时间',
      PRIMARY KEY (`id`),
      KEY `uid` (`uid`),
      KEY `date` (`date`),
      KEY `uid_date` (`uid`,`date`)
    ) 
    ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='广告详情页日访客数据聚合'
    PARTITION BY KEY(uid);
    [Err] 1503 - A PRIMARY KEY must include all columns in the table's partitioning function
    

      

    哈希分区

    散列分区 键分区区别

    MySQL :: MySQL 8.0 Reference Manual :: 23.2.5 KEY Partitioning https://dev.mysql.com/doc/refman/8.0/en/partitioning-key.html
    Partitioning by key is similar to partitioning by hash, except that where hash partitioning employs a user-defined expression, the hashing function for key partitioning is supplied by the MySQL server. NDB Cluster uses MD5() for this purpose; for tables using other storage engines, the server employs its own internal hashing function which is based on the same algorithm as PASSWORD().

    好的分区的标准

    MySQL :: MySQL 8.0 Reference Manual :: 23.2.4 HASH Partitioning https://dev.mysql.com/doc/refman/8.0/en/partitioning-hash.html

    By way of contrast, suppose that you have a column named int_col whose type is INT. Now consider the expression POW(5-int_col,3) + 6. This would be a poor choice for a hashing function because a change in the value of int_col is not guaranteed to produce a proportional change in the value of the expression. Changing the value of int_col by a given amount can produce widely differing changes in the value of the expression. For example, changing int_col from 5 to 6 produces a change of -1 in the value of the expression, but changing the value of int_col from 6 to 7 produces a change of -7 in the expression value.

    In other words, the more closely the graph of the column value versus the value of the expression follows a straight line as traced by the equation y=cx where c is some nonzero constant, the better the expression is suited to hashing. This has to do with the fact that the more nonlinear an expression is, the more uneven the distribution of data among the partitions it tends to produce.

    In theory, pruning is also possible for expressions involving more than one column value, but determining which of such expressions are suitable can be quite difficult and time-consuming. For this reason, the use of hashing expressions involving multiple columns is not particularly recommended.

    分区的结果随分区对象显著变化

    MySQL :: MySQL 8.0 Reference Manual :: 23.2.4 HASH Partitioning https://dev.mysql.com/doc/refman/8.0/en/partitioning-hash.html

    When PARTITION BY HASH is used, the storage engine determines which partition of num partitions to use based on the modulus of the result of the expression. In other words, for a given expression expr, the partition in which the record is stored is partition number N, where N = MOD(exprnum). Suppose that table t1 is defined as follows, so that it has 4 partitions:

    CREATE TABLE t1 (col1 INT, col2 CHAR(5), col3 DATE)
        PARTITION BY HASH( YEAR(col3) )
        PARTITIONS 4;

    If you insert a record into t1 whose col3 value is '2005-09-15', then the partition in which it is stored is determined as follows:

    MOD(YEAR('2005-09-01'),4)
    =  MOD(2005,4)
    =  1

    MySQL 8.0 also supports a variant of HASH partitioning known as linear hashing which employs a more complex algorithm for determining the placement of new rows inserted into the partitioned table. See Section 23.2.4.1, “LINEAR HASH Partitioning”, for a description of this algorithm.

    去除主键

    DROP TABLE IF EXISTS page_last_visitor;
    受影响的行: 0
    时间: 13.318s
    
    [SQL]
     CREATE TABLE `page_last_visitor` (
      `uid` int(11) NOT NULL DEFAULT 0 COMMENT '广告主ID',
      `address` varchar(1024) NOT NULL DEFAULT '' COMMENT '广告详情页',
      `pv` int(11) NOT NULL DEFAULT 0 COMMENT '日浏览总量',
      `ip` bigint(20) NOT NULL DEFAULT 0 COMMENT '访客最后访问ip',
      `date` int(11) NOT NULL DEFAULT 0 COMMENT '日期',
      `modify_time` int(11) NOT NULL DEFAULT 0 COMMENT '最后更新时间',
      KEY `uid` (`uid`),
      KEY `date` (`date`),
      KEY `uid_date` (`uid`,`date`)
    ) 
    ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='广告详情页日访客数据聚合'
    PARTITION BY HASH(uid)
    PARTITIONS 8092
    ;
    受影响的行: 0
    时间: 62.790s
    
    [SQL]
    
    DROP TABLE IF EXISTS search_engine_kw;
    受影响的行: 0
    时间: 0.047s
    
    [SQL]
    CREATE TABLE `search_engine_kw` (
      `uid` int(11) NOT NULL DEFAULT 0 COMMENT '广告主ID',
      `keyword` varchar(255) NOT NULL DEFAULT '' COMMENT '访客检索关键字',
      `pv` bigint(20) NOT NULL DEFAULT 0 COMMENT '访客浏览总量',
      `engine` int(11) NOT NULL DEFAULT 0 COMMENT '访客使用的搜索引擎',
      `date` int(11) NOT NULL DEFAULT 0 COMMENT '日期',
      `modify_time` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '最后更新时间',
      KEY `uid` (`uid`),
      KEY `date` (`date`),
      KEY `keyword` (`keyword`),
      KEY `uid_date` (`uid`,`date`)
    ) 
    ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='通过搜索引擎搜索关键字进入"广告详情页日访客数据聚合"'
    PARTITION BY HASH(uid)
    PARTITIONS 8092
    ;
    受影响的行: 0
    时间: 66.736s
    

      

    [root@d ~]# cat /etc/my.cnf
    # For advice on how to change settings please see
    # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

    [mysqld]
    #
    # Remove leading # and set to the amount of RAM for the most important data
    # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
    # innodb_buffer_pool_size = 128M
    #
    # Remove the leading "# " to disable binary logging
    # Binary logging captures changes between backups and is enabled by
    # default. It's default setting is log_bin=binlog
    # disable_log_bin
    #
    # Remove leading # to set options mainly useful for reporting servers.
    # The server defaults are faster for transactions and fast SELECTs.
    # Adjust sizes as needed, experiment to find the optimal values.
    # join_buffer_size = 128M
    # sort_buffer_size = 2M
    # read_rnd_buffer_size = 2M
    #
    # Remove leading # to revert to previous value for default_authentication_plugin,
    # this will increase compatibility with older clients. For background, see:
    # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
    # default-authentication-plugin=mysql_native_password

    datadir=/data/mysql/datadir
    socket=/var/lib/mysql/mysql.sock

    log-error=/data/mysql/log-error/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    [root@d ~]#

     执行建库-表前


    [root@d mongoexport]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/vda1 40G 23G 15G 61% /
    devtmpfs 16G 0 16G 0% /dev
    tmpfs 16G 0 16G 0% /dev/shm
    tmpfs 16G 498M 16G 4% /run
    tmpfs 16G 0 16G 0% /sys/fs/cgroup
    /dev/vdb 1.1T 893G 136G 87% /data
    tmpfs 3.2G 0 3.2G 0% /run/user/0
    [root@d mongoexport]#

    ceate database ad_detail_page;

    然后执行上述2个建表DML;

     建第一张表后


    [root@d ~]# df -h
    Filesystem Size Used Avail Use% Mounted on
    /dev/vda1 40G 23G 15G 61% /
    devtmpfs 16G 0 16G 0% /dev
    tmpfs 16G 0 16G 0% /dev/shm
    tmpfs 16G 497M 16G 4% /run
    tmpfs 16G 0 16G 0% /sys/fs/cgroup
    /dev/vdb 1.1T 898G 131G 88% /data
    tmpfs 3.2G 0 3.2G 0% /run/user/0
    [root@d ~]# du --max-depth=2 -h /data/mysql
    8.0K /data/mysql/log-error
    1.3G /data/mysql/datadir/ad_detail_page
    1.4M /data/mysql/datadir/performance_schema
    32K /data/mysql/datadir/mysql
    84K /data/mysql/datadir/sys
    164K /data/mysql/datadir/#innodb_temp
    1.5G /data/mysql/datadir
    1.5G /data/mysql
    [root@d ~]# ll -as /data/mysql/datadir/
    total 228904
    4 drwxr-xr-x 7 mysql mysql 4096 Dec 21 17:43 .
    4 drwxr-xr-x 4 mysql mysql 4096 Dec 21 17:15 ..
    460 drwxr-x--- 2 mysql mysql 471040 Dec 21 17:57 ad_detail_page
    4 -rw-r----- 1 mysql mysql 56 Dec 21 17:30 auto.cnf
    4 -rw-r----- 1 mysql mysql 1487 Dec 21 17:57 binlog.000001
    4 -rw-r----- 1 mysql mysql 16 Dec 21 17:31 binlog.index
    4 -rw------- 1 mysql mysql 1680 Dec 21 17:30 ca-key.pem
    4 -rw-r--r-- 1 mysql mysql 1112 Dec 21 17:30 ca.pem
    4 -rw-r--r-- 1 mysql mysql 1112 Dec 21 17:30 client-cert.pem
    4 -rw------- 1 mysql mysql 1680 Dec 21 17:30 client-key.pem
    8 -rw-r----- 1 mysql mysql 5751 Dec 21 17:31 ib_buffer_pool
    12288 -rw-r----- 1 mysql mysql 12582912 Dec 21 17:58 ibdata1
    49156 -rw-r----- 1 mysql mysql 50331648 Dec 21 17:58 ib_logfile0
    49156 -rw-r----- 1 mysql mysql 50331648 Dec 21 17:57 ib_logfile1
    12288 -rw-r----- 1 mysql mysql 12582912 Dec 21 17:31 ibtmp1
    4 drwxr-x--- 2 mysql mysql 4096 Dec 21 17:31 #innodb_temp
    4 drwxr-x--- 2 mysql mysql 4096 Dec 21 17:31 mysql
    77828 -rw-r----- 1 mysql mysql 79691776 Dec 21 17:58 mysql.ibd
    4 drwxr-x--- 2 mysql mysql 4096 Dec 21 17:30 performance_schema
    4 -rw------- 1 mysql mysql 1676 Dec 21 17:31 private_key.pem
    4 -rw-r--r-- 1 mysql mysql 452 Dec 21 17:31 public_key.pem
    4 -rw-r--r-- 1 mysql mysql 1112 Dec 21 17:30 server-cert.pem
    4 -rw------- 1 mysql mysql 1680 Dec 21 17:30 server-key.pem
    4 drwxr-x--- 2 mysql mysql 4096 Dec 21 17:31 sys
    17412 -rw-r----- 1 mysql mysql 17825792 Dec 21 17:58 undo_001
    10240 -rw-r----- 1 mysql mysql 10485760 Dec 21 17:58 undo_002
    [root@d ~]# ll -ash /data/mysql/datadir/
    total 224M
    4.0K drwxr-xr-x 7 mysql mysql 4.0K Dec 21 17:43 .
    4.0K drwxr-xr-x 4 mysql mysql 4.0K Dec 21 17:15 ..
    460K drwxr-x--- 2 mysql mysql 460K Dec 21 17:57 ad_detail_page
    4.0K -rw-r----- 1 mysql mysql 56 Dec 21 17:30 auto.cnf
    4.0K -rw-r----- 1 mysql mysql 1.5K Dec 21 17:57 binlog.000001
    4.0K -rw-r----- 1 mysql mysql 16 Dec 21 17:31 binlog.index
    4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 ca-key.pem
    4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 ca.pem
    4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 client-cert.pem
    4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 client-key.pem
    8.0K -rw-r----- 1 mysql mysql 5.7K Dec 21 17:31 ib_buffer_pool
    12M -rw-r----- 1 mysql mysql 12M Dec 21 17:58 ibdata1
    49M -rw-r----- 1 mysql mysql 48M Dec 21 17:58 ib_logfile0
    49M -rw-r----- 1 mysql mysql 48M Dec 21 17:57 ib_logfile1
    12M -rw-r----- 1 mysql mysql 12M Dec 21 17:31 ibtmp1
    4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:31 #innodb_temp
    4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:31 mysql
    77M -rw-r----- 1 mysql mysql 76M Dec 21 17:58 mysql.ibd
    4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:30 performance_schema
    4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:31 private_key.pem
    4.0K -rw-r--r-- 1 mysql mysql 452 Dec 21 17:31 public_key.pem
    4.0K -rw-r--r-- 1 mysql mysql 1.1K Dec 21 17:30 server-cert.pem
    4.0K -rw------- 1 mysql mysql 1.7K Dec 21 17:30 server-key.pem
    4.0K drwxr-x--- 2 mysql mysql 4.0K Dec 21 17:31 sys
    18M -rw-r----- 1 mysql mysql 17M Dec 21 17:58 undo_001
    10M -rw-r----- 1 mysql mysql 10M Dec 21 17:58 undo_002
    [root@d ~]# du --max-depth=1 -h /data/mysql/datadir/
    1.3G /data/mysql/datadir/ad_detail_page
    1.4M /data/mysql/datadir/performance_schema
    32K /data/mysql/datadir/mysql
    84K /data/mysql/datadir/sys
    164K /data/mysql/datadir/#innodb_temp
    1.5G /data/mysql/datadir/
    [root@d ~]#

    [root@d ~]# ll -as /data/mysql/datadir/ad_detail_page/ > tail
    [root@d ~]# tail tail
    164 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p992.ibd
    164 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p993.ibd
    164 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p994.ibd
    164 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p995.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p996.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p997.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p998.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p999.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:44 page_last_visitor#P#p99.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:44 page_last_visitor#P#p9.ibd
    [root@d ~]# head tail
    total 1308640
    460 drwxr-x--- 2 mysql mysql 471040 Dec 21 17:57 .
    4 drwxr-xr-x 7 mysql mysql 4096 Dec 21 17:43 ..
    532 -rw-r----- 1 mysql mysql 540672 Dec 21 17:58 page_last_visitor#P#p0.ibd
    164 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p1000.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p1001.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p1002.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p1003.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p1004.ibd
    160 -rw-r----- 1 mysql mysql 163840 Dec 21 17:46 page_last_visitor#P#p1005.ibd
    [root@d ~]#

    检查进程


    mysql> show processlist;
    +----+-----------------+-----------+------+---------+-------+------------------------+------------------+
    | Id | User | Host | db | Command | Time | State | Info |
    +----+-----------------+-----------+------+---------+-------+------------------------+------------------+
    | 4 | event_scheduler | localhost | NULL | Daemon | 52805 | Waiting on empty queue | NULL |
    | 11 | root | localhost | NULL | Query | 0 | starting | show processlist |
    +----+-----------------+-----------+------+---------+-------+------------------------+------------------+
    2 rows in set (0.00 sec)

    建第二张表


    mysql> show processlist;
    +----+-----------------+-----------+----------------+---------+-------+------------------------+------------------------------------------------------------------------------------------------------+
    | Id | User | Host | db | Command | Time | State | Info |
    +----+-----------------+-----------+----------------+---------+-------+------------------------+------------------------------------------------------------------------------------------------------+
    | 4 | event_scheduler | localhost | NULL | Daemon | 53060 | Waiting on empty queue | NULL |
    | 11 | root | localhost | ad_detail_page | Query | 84 | creating table | CREATE TABLE `search_engine_kw` (
    `uid` int(11) NOT NULL DEFAULT 0 COMMENT '广告主ID',
    `keywo |
    | 12 | root | localhost | NULL | Query | 0 | starting | show processlist |
    +----+-----------------+-----------+----------------+---------+-------+------------------------+------------------------------------------------------------------------------------------------------+
    3 rows in set (0.00 sec)


    mysql> show processlist;
    +----+-----------------+-----------+------+---------+--------+------------------ ------+------------------+
    | Id | User | Host | db | Command | Time | State | Info |
    +----+-----------------+-----------+------+---------+--------+------------------ ------+------------------+
    | 4 | event_scheduler | localhost | NULL | Daemon | 103817 | Waiting on empty queue | NULL |
    | 13 | root | localhost | NULL | Query | 0 | starting | show processlist |
    +----+-----------------+-----------+------+---------+--------+------------------ ------+------------------+
    2 rows in set (0.00 sec)


    mysql> show processlist;
    +----+-----------------+-----------+------+---------+--------+------------------------+------------------+
    | Id | User | Host | db | Command | Time | State | Info |
    +----+-----------------+-----------+------+---------+--------+------------------------+------------------+
    | 4 | event_scheduler | localhost | NULL | Daemon | 103827 | Waiting on empty queue | NULL |
    | 13 | root | localhost | NULL | Query | 0 | starting | show processlist |
    +----+-----------------+-----------+------+---------+--------+------------------------+------------------+
    2 rows in set (0.00 sec)

    mysql> use ad_detail_page;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Database changed
    mysql> show tables;
    +--------------------------+
    | Tables_in_ad_detail_page |
    +--------------------------+
    | page_last_visitor |
    | search_engine_kw |
    +--------------------------+
    2 rows in set (0.02 sec)

    [root@d ~]# du --max-depth=2 -h /data/mysql/
    8.0K /data/mysql/log-error
    2.7G /data/mysql/datadir/ad_detail_page
    1.4M /data/mysql/datadir/performance_schema
    32K /data/mysql/datadir/mysql
    84K /data/mysql/datadir/sys
    228K /data/mysql/datadir/#innodb_temp
    3.0G /data/mysql/datadir
    3.0G /data/mysql/
    [root@d ~]#

    mysql> select * FROm page_last_visitor
    -> ;
    Empty set (41.90 sec)

    mysql> select * FROm page_last_visitor;
    Empty set (0.36 sec)

    mysql> select * FROm page_last_visitor;
    Empty set (0.33 sec)

    mysql> select * FROm page_last_visitor where uid=2;
    Empty set (0.02 sec)

    mysql> select * FROm page_last_visitor where uid=24;
    Empty set (0.05 sec)

    执行以上sql时,cpu 内存 空余超过50%;数据库为建表后,无其他写操作;

    改变分区数

    删表

    DROP TABLE IF EXISTS page_last_visitor;

    | 18 | root | localhost | ad_detail_page | Query | 282 | checking permissions | DROP TABLE IF EXISTS page_last_visitor |

    检查权限

    mysql权限 字段,到分区级别了么?

    PARTITIONS 128

    降低分区数为128后


    [root@d ~]# du --max-depth=2 -h /data/mysql/
    8.0K /data/mysql/log-error
    44M /data/mysql/datadir/ad_detail_page
    1.4M /data/mysql/datadir/performance_schema
    32K /data/mysql/datadir/mysql
    84K /data/mysql/datadir/sys
    228K /data/mysql/datadir/#innodb_temp
    326M /data/mysql/datadir
    326M /data/mysql/
    [root@d ~]# du --max-depth=2 -h /data/mysql/datadir/
    44M /data/mysql/datadir/ad_detail_page
    1.4M /data/mysql/datadir/performance_schema
    32K /data/mysql/datadir/mysql
    84K /data/mysql/datadir/sys
    228K /data/mysql/datadir/#innodb_temp
    326M /data/mysql/datadir/
    [root@d ~]# du --max-depth=2 -h /data/mysql/datadir/ad_detail_page/
    44M /data/mysql/datadir/ad_detail_page/
    [root@d ~]#
    [root@d ~]# tree /data/mysql/datadir/ad_detail_page/
    /data/mysql/datadir/ad_detail_page/
    ├── page_last_visitor#P#p0.ibd
    ├── page_last_visitor#P#p100.ibd
    ├── page_last_visitor#P#p101.ibd
    ├── page_last_visitor#P#p102.ibd
    ├── page_last_visitor#P#p103.ibd
    ├── page_last_visitor#P#p104.ibd
    ├── page_last_visitor#P#p105.ibd
    ├── page_last_visitor#P#p106.ibd
    ├── page_last_visitor#P#p107.ibd
    ├── page_last_visitor#P#p108.ibd
    ├── page_last_visitor#P#p109.ibd
    ├── page_last_visitor#P#p10.ibd
    ├── page_last_visitor#P#p110.ibd
    ├── page_last_visitor#P#p111.ibd
    ├── page_last_visitor#P#p112.ibd
    ├── page_last_visitor#P#p113.ibd
    ├── page_last_visitor#P#p114.ibd
    ├── page_last_visitor#P#p115.ibd
    ├── page_last_visitor#P#p116.ibd
    ├── page_last_visitor#P#p117.ibd
    ├── page_last_visitor#P#p118.ibd
    ├── page_last_visitor#P#p119.ibd
    ├── page_last_visitor#P#p11.ibd
    ├── page_last_visitor#P#p120.ibd
    ├── page_last_visitor#P#p121.ibd
    ├── page_last_visitor#P#p122.ibd
    ├── page_last_visitor#P#p123.ibd
    ├── page_last_visitor#P#p124.ibd
    ├── page_last_visitor#P#p125.ibd
    ├── page_last_visitor#P#p126.ibd
    ├── page_last_visitor#P#p127.ibd
    ├── page_last_visitor#P#p12.ibd
    ├── page_last_visitor#P#p13.ibd
    ├── page_last_visitor#P#p14.ibd
    ├── page_last_visitor#P#p15.ibd
    ├── page_last_visitor#P#p16.ibd
    ├── page_last_visitor#P#p17.ibd
    ├── page_last_visitor#P#p18.ibd
    ├── page_last_visitor#P#p19.ibd
    ├── page_last_visitor#P#p1.ibd
    ├── page_last_visitor#P#p20.ibd
    ├── page_last_visitor#P#p21.ibd
    ├── page_last_visitor#P#p22.ibd
    ├── page_last_visitor#P#p23.ibd
    ├── page_last_visitor#P#p24.ibd
    ├── page_last_visitor#P#p25.ibd
    ├── page_last_visitor#P#p26.ibd
    ├── page_last_visitor#P#p27.ibd
    ├── page_last_visitor#P#p28.ibd
    ├── page_last_visitor#P#p29.ibd
    ├── page_last_visitor#P#p2.ibd
    ├── page_last_visitor#P#p30.ibd
    ├── page_last_visitor#P#p31.ibd
    ├── page_last_visitor#P#p32.ibd
    ├── page_last_visitor#P#p33.ibd
    ├── page_last_visitor#P#p34.ibd
    ├── page_last_visitor#P#p35.ibd
    ├── page_last_visitor#P#p36.ibd
    ├── page_last_visitor#P#p37.ibd
    ├── page_last_visitor#P#p38.ibd
    ├── page_last_visitor#P#p39.ibd
    ├── page_last_visitor#P#p3.ibd
    ├── page_last_visitor#P#p40.ibd
    ├── page_last_visitor#P#p41.ibd
    ├── page_last_visitor#P#p42.ibd
    ├── page_last_visitor#P#p43.ibd
    ├── page_last_visitor#P#p44.ibd
    ├── page_last_visitor#P#p45.ibd
    ├── page_last_visitor#P#p46.ibd
    ├── page_last_visitor#P#p47.ibd
    ├── page_last_visitor#P#p48.ibd
    ├── page_last_visitor#P#p49.ibd
    ├── page_last_visitor#P#p4.ibd
    ├── page_last_visitor#P#p50.ibd
    ├── page_last_visitor#P#p51.ibd
    ├── page_last_visitor#P#p52.ibd
    ├── page_last_visitor#P#p53.ibd
    ├── page_last_visitor#P#p54.ibd
    ├── page_last_visitor#P#p55.ibd
    ├── page_last_visitor#P#p56.ibd
    ├── page_last_visitor#P#p57.ibd
    ├── page_last_visitor#P#p58.ibd
    ├── page_last_visitor#P#p59.ibd
    ├── page_last_visitor#P#p5.ibd
    ├── page_last_visitor#P#p60.ibd
    ├── page_last_visitor#P#p61.ibd
    ├── page_last_visitor#P#p62.ibd
    ├── page_last_visitor#P#p63.ibd
    ├── page_last_visitor#P#p64.ibd
    ├── page_last_visitor#P#p65.ibd
    ├── page_last_visitor#P#p66.ibd
    ├── page_last_visitor#P#p67.ibd
    ├── page_last_visitor#P#p68.ibd
    ├── page_last_visitor#P#p69.ibd
    ├── page_last_visitor#P#p6.ibd
    ├── page_last_visitor#P#p70.ibd
    ├── page_last_visitor#P#p71.ibd
    ├── page_last_visitor#P#p72.ibd
    ├── page_last_visitor#P#p73.ibd
    ├── page_last_visitor#P#p74.ibd
    ├── page_last_visitor#P#p75.ibd
    ├── page_last_visitor#P#p76.ibd
    ├── page_last_visitor#P#p77.ibd
    ├── page_last_visitor#P#p78.ibd
    ├── page_last_visitor#P#p79.ibd
    ├── page_last_visitor#P#p7.ibd
    ├── page_last_visitor#P#p80.ibd
    ├── page_last_visitor#P#p81.ibd
    ├── page_last_visitor#P#p82.ibd
    ├── page_last_visitor#P#p83.ibd
    ├── page_last_visitor#P#p84.ibd
    ├── page_last_visitor#P#p85.ibd
    ├── page_last_visitor#P#p86.ibd
    ├── page_last_visitor#P#p87.ibd
    ├── page_last_visitor#P#p88.ibd
    ├── page_last_visitor#P#p89.ibd
    ├── page_last_visitor#P#p8.ibd
    ├── page_last_visitor#P#p90.ibd
    ├── page_last_visitor#P#p91.ibd
    ├── page_last_visitor#P#p92.ibd
    ├── page_last_visitor#P#p93.ibd
    ├── page_last_visitor#P#p94.ibd
    ├── page_last_visitor#P#p95.ibd
    ├── page_last_visitor#P#p96.ibd
    ├── page_last_visitor#P#p97.ibd
    ├── page_last_visitor#P#p98.ibd
    ├── page_last_visitor#P#p99.ibd
    ├── page_last_visitor#P#p9.ibd
    ├── search_engine_kw#P#p0.ibd
    ├── search_engine_kw#P#p100.ibd
    ├── search_engine_kw#P#p101.ibd
    ├── search_engine_kw#P#p102.ibd
    ├── search_engine_kw#P#p103.ibd
    ├── search_engine_kw#P#p104.ibd
    ├── search_engine_kw#P#p105.ibd
    ├── search_engine_kw#P#p106.ibd
    ├── search_engine_kw#P#p107.ibd
    ├── search_engine_kw#P#p108.ibd
    ├── search_engine_kw#P#p109.ibd
    ├── search_engine_kw#P#p10.ibd
    ├── search_engine_kw#P#p110.ibd
    ├── search_engine_kw#P#p111.ibd
    ├── search_engine_kw#P#p112.ibd
    ├── search_engine_kw#P#p113.ibd
    ├── search_engine_kw#P#p114.ibd
    ├── search_engine_kw#P#p115.ibd
    ├── search_engine_kw#P#p116.ibd
    ├── search_engine_kw#P#p117.ibd
    ├── search_engine_kw#P#p118.ibd
    ├── search_engine_kw#P#p119.ibd
    ├── search_engine_kw#P#p11.ibd
    ├── search_engine_kw#P#p120.ibd
    ├── search_engine_kw#P#p121.ibd
    ├── search_engine_kw#P#p122.ibd
    ├── search_engine_kw#P#p123.ibd
    ├── search_engine_kw#P#p124.ibd
    ├── search_engine_kw#P#p125.ibd
    ├── search_engine_kw#P#p126.ibd
    ├── search_engine_kw#P#p127.ibd
    ├── search_engine_kw#P#p12.ibd
    ├── search_engine_kw#P#p13.ibd
    ├── search_engine_kw#P#p14.ibd
    ├── search_engine_kw#P#p15.ibd
    ├── search_engine_kw#P#p16.ibd
    ├── search_engine_kw#P#p17.ibd
    ├── search_engine_kw#P#p18.ibd
    ├── search_engine_kw#P#p19.ibd
    ├── search_engine_kw#P#p1.ibd
    ├── search_engine_kw#P#p20.ibd
    ├── search_engine_kw#P#p21.ibd
    ├── search_engine_kw#P#p22.ibd
    ├── search_engine_kw#P#p23.ibd
    ├── search_engine_kw#P#p24.ibd
    ├── search_engine_kw#P#p25.ibd
    ├── search_engine_kw#P#p26.ibd
    ├── search_engine_kw#P#p27.ibd
    ├── search_engine_kw#P#p28.ibd
    ├── search_engine_kw#P#p29.ibd
    ├── search_engine_kw#P#p2.ibd
    ├── search_engine_kw#P#p30.ibd
    ├── search_engine_kw#P#p31.ibd
    ├── search_engine_kw#P#p32.ibd
    ├── search_engine_kw#P#p33.ibd
    ├── search_engine_kw#P#p34.ibd
    ├── search_engine_kw#P#p35.ibd
    ├── search_engine_kw#P#p36.ibd
    ├── search_engine_kw#P#p37.ibd
    ├── search_engine_kw#P#p38.ibd
    ├── search_engine_kw#P#p39.ibd
    ├── search_engine_kw#P#p3.ibd
    ├── search_engine_kw#P#p40.ibd
    ├── search_engine_kw#P#p41.ibd
    ├── search_engine_kw#P#p42.ibd
    ├── search_engine_kw#P#p43.ibd
    ├── search_engine_kw#P#p44.ibd
    ├── search_engine_kw#P#p45.ibd
    ├── search_engine_kw#P#p46.ibd
    ├── search_engine_kw#P#p47.ibd
    ├── search_engine_kw#P#p48.ibd
    ├── search_engine_kw#P#p49.ibd
    ├── search_engine_kw#P#p4.ibd
    ├── search_engine_kw#P#p50.ibd
    ├── search_engine_kw#P#p51.ibd
    ├── search_engine_kw#P#p52.ibd
    ├── search_engine_kw#P#p53.ibd
    ├── search_engine_kw#P#p54.ibd
    ├── search_engine_kw#P#p55.ibd
    ├── search_engine_kw#P#p56.ibd
    ├── search_engine_kw#P#p57.ibd
    ├── search_engine_kw#P#p58.ibd
    ├── search_engine_kw#P#p59.ibd
    ├── search_engine_kw#P#p5.ibd
    ├── search_engine_kw#P#p60.ibd
    ├── search_engine_kw#P#p61.ibd
    ├── search_engine_kw#P#p62.ibd
    ├── search_engine_kw#P#p63.ibd
    ├── search_engine_kw#P#p64.ibd
    ├── search_engine_kw#P#p65.ibd
    ├── search_engine_kw#P#p66.ibd
    ├── search_engine_kw#P#p67.ibd
    ├── search_engine_kw#P#p68.ibd
    ├── search_engine_kw#P#p69.ibd
    ├── search_engine_kw#P#p6.ibd
    ├── search_engine_kw#P#p70.ibd
    ├── search_engine_kw#P#p71.ibd
    ├── search_engine_kw#P#p72.ibd
    ├── search_engine_kw#P#p73.ibd
    ├── search_engine_kw#P#p74.ibd
    ├── search_engine_kw#P#p75.ibd
    ├── search_engine_kw#P#p76.ibd
    ├── search_engine_kw#P#p77.ibd
    ├── search_engine_kw#P#p78.ibd
    ├── search_engine_kw#P#p79.ibd
    ├── search_engine_kw#P#p7.ibd
    ├── search_engine_kw#P#p80.ibd
    ├── search_engine_kw#P#p81.ibd
    ├── search_engine_kw#P#p82.ibd
    ├── search_engine_kw#P#p83.ibd
    ├── search_engine_kw#P#p84.ibd
    ├── search_engine_kw#P#p85.ibd
    ├── search_engine_kw#P#p86.ibd
    ├── search_engine_kw#P#p87.ibd
    ├── search_engine_kw#P#p88.ibd
    ├── search_engine_kw#P#p89.ibd
    ├── search_engine_kw#P#p8.ibd
    ├── search_engine_kw#P#p90.ibd
    ├── search_engine_kw#P#p91.ibd
    ├── search_engine_kw#P#p92.ibd
    ├── search_engine_kw#P#p93.ibd
    ├── search_engine_kw#P#p94.ibd
    ├── search_engine_kw#P#p95.ibd
    ├── search_engine_kw#P#p96.ibd
    ├── search_engine_kw#P#p97.ibd
    ├── search_engine_kw#P#p98.ibd
    ├── search_engine_kw#P#p99.ibd
    └── search_engine_kw#P#p9.ibd

    0 directories, 256 files
    [root@d ~]#

  • 相关阅读:
    Java注解详解
    浅析@Deprecated
    BeanUtils使用概要
    使用内省方式操作JavaBean
    怎样通过ajax提交数据
    Java 反射学习笔记
    jackson 学习笔记
    Dom4j 学习笔记
    Tensorflow打造聊天机器人
    Hive官方文档
  • 原文地址:https://www.cnblogs.com/rsapaper/p/10107511.html
Copyright © 2011-2022 走看看