# Compress at partition level

**URL:** <https://forums.percona.com/t/compress-at-partition-level/24783>\
**Category:** Percona Server for MySQL 8.0\
**Created:** [August 29, 2023, 1:08pm UTC](https://forums.percona.com/t/compress-at-partition-level/24783 "2023-08-29T13:08:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jamie\_Downs](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jamie_downs/32/5836_2.png) [@Jamie\_Downs](https://forums.percona.com/u/Jamie_Downs)\
**Post date:** [August 29, 2023, 1:08pm UTC](https://forums.percona.com/t/compress-at-partition-level/24783/1 "2023-08-29T13:08:38Z")

</div>

Hello,  
I’m aware it’s not possible to compress at a partition level. I was wondering if others would find this feature useful or if there are any plans to implement it?  
Thanks.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 29, 2023, 1:38pm UTC](https://forums.percona.com/t/compress-at-partition-level/24783/2 "2023-08-29T13:38:53Z")

</div>

To which database are you referring?

---

<div class="post-metadata">

**Author:** ![Jamie\_Downs](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/jamie_downs/32/5836_2.png) [@Jamie\_Downs](https://forums.percona.com/u/Jamie_Downs)\
**Post date:** [August 29, 2023, 1:51pm UTC](https://forums.percona.com/t/compress-at-partition-level/24783/3 "2023-08-29T13:51:38Z")

</div>

Apologies. MySQL 8.0. We have some large partitioned audit tables. It would be very useful if we could compress the older partitions.

I did experiment with creating a compressed table per year and then using a View for selects. The performance sucked. The indexes on the underlying tables were not used.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [August 30, 2023, 1:01am UTC](https://forums.percona.com/t/compress-at-partition-level/24783/4 "2023-08-30T01:01:32Z")

</div>

Who said you can’t compress partitioned tables?

```auto
CREATE TABLE `members` (
  `firstname` varchar(25) NOT NULL,
  `lastname` varchar(25) NOT NULL,
  `username` varchar(16) NOT NULL,
  `email` varchar(35) DEFAULT NULL,
  `joined` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPRESSED
PARTITION BY RANGE (year(`joined`))
(PARTITION p0 VALUES LESS THAN (1960) ENGINE = InnoDB,
 PARTITION p1 VALUES LESS THAN (1970) ENGINE = InnoDB,
 PARTITION p2 VALUES LESS THAN (1980) ENGINE = InnoDB,
 PARTITION p3 VALUES LESS THAN (1990) ENGINE = InnoDB,
 PARTITION p4 VALUES LESS THAN MAXVALUE ENGINE = InnoDB);

```

Why do you want to only compress specific partitions? Just compress the whole table. What are you losing by doing that?
