# Optimize table removes the data directory in partitions

**URL:** https://forums.percona.com/t/optimize-table-removes-the-data-directory-in-partitions/3916
**Category:** Other MySQL® Questions
**Created:** [November 30, 2014, 4:02am UTC](https://forums.percona.com/t/optimize-table-removes-the-data-directory-in-partitions/3916 "2014-11-30T04:02:49Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Chavy](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Chavy](https://forums.percona.com/u/Chavy)
#### Post date: [November 30, 2014, 4:02am UTC](https://forums.percona.com/t/optimize-table-removes-the-data-directory-in-partitions/3916/1 "2014-11-30T04:02:49Z")

</div>

> [@](#):
>
> ```auto
> CREATE TABLE `TEST` (
> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `a2` mediumtext NOT NULL,
> `a3` char(100) NOT NULL,
> `prt` tinyint(1) unsigned NOT NULL,
> PRIMARY KEY (`id`,`prt`)
> ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
> /*!50100 PARTITION BY LIST (`prt`)
> (PARTITION p0 VALUES IN (0) ENGINE = InnoDB,
> PARTITION p1 VALUES IN (1) DATA DIRECTORY = '/tmp' ENGINE = InnoDB) */;
> 
> ```

> [@](#):
>
> ```auto
> OPTIMIZE TABLE TEST;
> 
> ```

It becomes:

> [@](#):
>
> ```auto
> CREATE TABLE `TEST` (
> `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `a2` mediumtext NOT NULL,
> `a3` char(100) NOT NULL,
> `prt` tinyint(1) unsigned NOT NULL,
> PRIMARY KEY (`id`,`prt`)
> ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
> /*!50100 PARTITION BY LIST (`prt`)
> (PARTITION p0 VALUES IN (0) ENGINE = InnoDB,
> PARTITION p1 VALUES IN (1) ENGINE = InnoDB) */;
> 
> ```

Partition p1 moves from /tmp into main mysql db directory (in datadir)

Percona: 5.6.21-69.0

---

<div class="post-metadata">

### Author: ![Chavy](https://avatars.discourse-cdn.com/v4/letter/c/919ad9/32.png) [@Chavy](https://forums.percona.com/u/Chavy)
#### Post date: [December 3, 2014, 9:38am UTC](https://forums.percona.com/t/optimize-table-removes-the-data-directory-in-partitions/3916/2 "2014-12-03T09:38:08Z")

</div>

Is this a known bug? Or is it something Im doing wrong?

---

<div class="post-metadata">

### Author: ![niljoshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/niljoshi/32/16889_2.png) [@niljoshi](https://forums.percona.com/u/niljoshi)
#### Post date: [December 5, 2014, 2:51am UTC](https://forums.percona.com/t/optimize-table-removes-the-data-directory-in-partitions/3916/3 "2014-12-05T02:51:22Z")

</div>

Hi Chavy,

Thanks for reporting this. This is indeed bug and not well known so I have already reported it. Please subscribe it for further update.

[url][MySQL Bugs: #75112: Optimize table removes the data directory in partitions](http://bugs.mysql.com/bug.php?id=75112%5B/url%5D) – upstream  
[url][https://bugs.launchpad.net/percona-server/+bug/1399562[/url]](https://bugs.launchpad.net/percona-server/+bug/1399562%5B/url%5D)

---

<div class="post-metadata">

### Author: ![Rick\_James](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@Rick\_James](https://forums.percona.com/u/Rick_James)
#### Post date: [February 4, 2015, 11:03pm UTC](https://forums.percona.com/t/optimize-table-removes-the-data-directory-in-partitions/3916/4 "2015-02-04T23:03:04Z")

</div>

If your goal was to get a performance boost by carefully placing MySQL files on different physical drives… In general, you get a better perf boost by using RAID striping.
