# Xtrabackup not compressing all files

**URL:** <https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779>\
**Category:** Percona XtraBackup\
**Created:** [June 3, 2024, 11:08am UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779 "2024-06-03T11:08:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danie\_Le\_Roux](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/danie_le_roux/32/16453_2.png) [@Danie\_Le\_Roux](https://forums.percona.com/u/Danie_Le_Roux)\
**Post date:** [June 3, 2024, 11:08am UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/1 "2024-06-03T11:08:15Z")

</div>

Hi Team,

What would be the reason for Xtrabackup not to compressing all the ibd files?

Xtrabackup version  
[Xtrabackup] recognized server arguments: --datadir=/mysqldata --innodb\_flush\_method=O\_DIRECT --innodb\_log\_files\_in\_group=2 --innodb\_log\_file\_size=1G --innodb\_flush\_log\_at\_trx\_commit=1 --innodb\_file\_per\_table=1 --innodb\_buffer\_pool\_size=16G --log\_bin=mysql-bin --server-id=1 --open\_files\_limit=65535  
xtrabackup version 8.0.35-30 based on MySQL server 8.0.35 Linux (x86\_64) (revision id: 6beb4b49)

Command used:  
xtrabackup --backup --compress --target-dir=/backups/databases/physical/sunday\_full/

Log file output:  
2024-06-03T12:51:12.805799+02:00 2 [Note] [MY-011825] [Xtrabackup] Compressing ./delta\_sap\_schweppes/customer.ibd to /backups/databases/physical/sunday\_full/delta\_sap\_schweppes/customer.ibd

2024-06-03T12:51:12.926955+02:00 2 [Note] [MY-011825] [Xtrabackup] Done: Compressing ./delta\_sap\_schweppes/customer.ibd to /backups/databases/physical/sunday\_full/delta\_sap\_schweppes/customer.ibd

---

<div class="post-metadata">

**Author:** ![Abhinav\_Gupta](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/abhinav_gupta/32/6262_2.png) [@Abhinav\_Gupta](https://forums.percona.com/u/Abhinav_Gupta)\
**Post date:** [June 3, 2024, 3:21pm UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/2 "2024-06-03T15:21:36Z")

</div>

Since 8.0.34 Xtrabackup, by default, Xtrabackup uses the ZSTD compression technique, and the older compression qp has been removed. You can now see the compressed file extension with .zst.

1. Ensure you have zstd package installed on the server.

2. Please try the command with --compress-threads=4

```auto
xtrabackup --backup --compress --compress-threads=4 \
--target-dir=/data/compressed/

```

1. Please try to mention another compression technique --compress=lz4 explicitly

```auto
xtrabackup --backup --compress=lz4 --target-dir=/data/backup

```

---

<div class="post-metadata">

**Author:** ![Danie\_Le\_Roux](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/danie_le_roux/32/16453_2.png) [@Danie\_Le\_Roux](https://forums.percona.com/u/Danie_Le_Roux)\
**Post date:** [June 4, 2024, 9:16am UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/4 "2024-06-04T09:16:54Z")

</div>

Hi Abhinav,

Compression is working but only for some ibd files, for example

as\_stock\_parent\_deduct.ibd  
as\_stock\_slot\_variance\_reasons.ibd  
as\_stock\_slots.ibd  
as\_stock\_snapshot.ibd.zst  
as\_stock\_take.ibd.zst

I’ve tried both --compress-threads=4 and --compress=lz4, still the same outcome.

---

<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:** [June 4, 2024, 7:57pm UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/5 "2024-06-04T19:57:38Z")

</div>

Hi @Danie_Le_Roux Can you please run PXB with additional logging and/or debug output? Is this 100% repeatable? Is it the same tables that do not get compressed or is it different tables each time you run PXB?

---

<div class="post-metadata">

**Author:** ![Danie\_Le\_Roux](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/danie_le_roux/32/16453_2.png) [@Danie\_Le\_Roux](https://forums.percona.com/u/Danie_Le_Roux)\
**Post date:** [June 5, 2024, 7:12am UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/6 "2024-06-05T07:12:34Z")

</div>

Hi Matthew,

What is the flag for extra logging?

It seems that none of the ibd files gets compressed, only the mysql and xtrabackup files.  
For example, the below files is compressed  
-rw-r----- 1 root root 258930 Jun 5 09:06 ib\_buffer\_pool.zst  
-rw-r----- 1 root root 40504413 Jun 5 09:06 ibdata1.zst  
-rw-r----- 1 root root 114 Jun 5 09:06 mysql-bin.000695.zst  
-rw-r----- 1 root root 32 Jun 5 09:06 mysql-bin.index.zst  
-rw-r----- 1 root root 66800994 Jun 5 09:06 mysql.ibd.zst  
-rw-r----- 1 root root 22081136 Jun 5 09:06 undo\_001.zst  
-rw-r----- 1 root root 15940185 Jun 5 09:06 undo\_002.zst  
-rw-r----- 1 root root 34 Jun 5 09:06 xtrabackup\_binlog\_info.zst

None of the ibd files is compressed, example below  
-rw-r----- 1 root root 128K Jun 5 09:06 as\_stock\_slots.ibd  
-rw-r----- 1 root root 1.7G Jun 5 09:06 as\_stock\_snapshot.ibd  
-rw-r----- 1 root root 192K Jun 5 09:06 as\_stock\_take.ibd  
-rw-r----- 1 root root 224K Jun 5 09:06 as\_stock\_take\_items.ibd

---

<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:** [June 5, 2024, 1:55pm UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/7 "2024-06-05T13:55:42Z")

</div>

Are these tables encrypted? I see you have another post about Vault encryption. Could there be some issue with the two?

---

<div class="post-metadata">

**Author:** ![Danie\_Le\_Roux](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/danie_le_roux/32/16453_2.png) [@Danie\_Le\_Roux](https://forums.percona.com/u/Danie_Le_Roux)\
**Post date:** [June 5, 2024, 2:05pm UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/8 "2024-06-05T14:05:15Z")

</div>

Hi Matthew,

Yes, tables are encrypted.  
Not sure if this is related to my Vault issue in the other post

---

<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:** [June 5, 2024, 4:51pm UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/9 "2024-06-05T16:51:02Z")

</div>

Since these tables that are not getting compressed are encrypted AND you are having issues with encrypted tables in general, I suggest we focus efforts on solving the Vault issue first and once that is all good, if the tables are still not compressing, we can look more.

---

<div class="post-metadata">

**Author:** ![Danie\_Le\_Roux](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/danie_le_roux/32/16453_2.png) [@Danie\_Le\_Roux](https://forums.percona.com/u/Danie_Le_Roux)\
**Post date:** [June 13, 2024, 1:42pm UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/10 "2024-06-13T13:42:20Z")

</div>

Hi Matthew,

I’ve changed my encryption from Vault to local File Key component based and PXB is now working on 85+ databases with over 1.5T, however I’m still facing the issues of my ibd files not compressing. I’ve switch off encryption on some of the tables and noticed that they get compressed if I do that. Does that mean that encrypted tables does not get compressed?

Table testa = Encrypted

Jun 13 13:33 db.opt.lz4  
Jun 13 13:33 testa.ibd  
Jun 13 13:33 testb.MYD.lz4  
Jun 13 13:33 testb.MYI.lz4  
Jun 13 13:33 testb\_11898.sdi.lz4

Table testa = Not Encrypted  
Jun 13 13:39 db.opt.lz4  
Jun 13 13:39 testa.ibd.lz4  
Jun 13 13:39 testb.MYD.lz4  
Jun 13 13:39 testb.MYI.lz4  
Jun 13 13:39 testb\_11898.sdi.lz4

---

<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:** [June 18, 2024, 1:17pm UTC](https://forums.percona.com/t/xtrabackup-not-compressing-all-files/30779/11 "2024-06-18T13:17:16Z")

</div>

Hello @Danie_Le_Roux,  
I could not find it documented, but Percona’s CTO confirmed that encrypted tables are not compressed:

> Vadim T: there is no benefit from compressing encrypted data. typically there is about 0% compression can be achieved
