每个分区在我硬盘上的不同磁盘上

每个分区在我硬盘上的不同磁盘上

本文介绍了分区表,每个分区在我硬盘上的不同磁盘上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要在MYSQL 5.5中进行分区的表.我知道该怎么做,但我还需要为每个分区指定一个磁盘.

I have a table that I would like to partition in MYSQL 5.5. That I know how to do, but what I also need is to specify a disk for each of my partitions.

例如,我想输入:

  • c:\
  • 中的P01
  • d02中的P02:\
  • .......

以此类推.

我当前正在使用以下语句:(这不能满足我的要求,但是效果很好)

I'm currently using this statement: (which doesn't fulfil my requirements, but works perfectly)

ALTER TABLE transaction_transaction
PARTITION BY RANGE (effectiveDate_)(
  PARTITION p01 VALUES Less Than (1288562400000),
  PARTITION p02 VALUES Less Than (1293660000000),
  PARTITION p03 VALUES Less Than (1298757600000),
  PARTITION p04 VALUES Less Than (1303855200000),
  PARTITION p05 VALUES Less Than (1308952800000),
  PARTITION p06 VALUES Less Than (1314050400000),
  PARTITION p07 VALUES Less Than (1319148000000),
  PARTITION p08 VALUES Less Than (1324245600000),
  PARTITION p09 VALUES Less Than (1329343200000),
  PARTITION p10 VALUES Less Than (1334440800000),
  PARTITION p11 VALUES Less Than (1339538400000),
  PARTITION p12 VALUES Less Than (1344636000000),
  PARTITION p13 VALUES Less Than (1349733600000),
  PARTITION p14 VALUES Less Than (1354831200000),
  PARTITION p15 VALUES Less Than (1359928800000),
  PARTITION p16 VALUES Less Than (1365026400000),
  PARTITION p17 VALUES Less Than (1370124000000)
);

推荐答案

...
PARTITION p0
  VALUES LESS THAN (1288562400000)
  DATA DIRECTORY ="C:\\foo\\bar"
  INDEX DIRECTORY ="C:\\foo\\baz",
...

请注意,这需要关闭NO_DIR_IN_CREATE

Mind that this needs NO_DIR_IN_CREATE to be off

user963602指出,由于MySQL错误,这在Windows上无法直接使用,请参阅我的评论以找到解决方法

As user963602 points out, this doesn't directly work on windows due to a MySQL bug, see my comment for a workaround

这篇关于分区表,每个分区在我硬盘上的不同磁盘上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 13:51