# Xtrabackup prepare consumes high amounts of memory

**URL:** <https://forums.percona.com/t/xtrabackup-prepare-consumes-high-amounts-of-memory/21180>\
**Category:** Percona XtraBackup\
**Created:** [April 4, 2023, 2:04pm UTC](https://forums.percona.com/t/xtrabackup-prepare-consumes-high-amounts-of-memory/21180 "2023-04-04T14:04:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mikhail\_Nikitin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mikhail_nikitin/32/9995_2.png) [@Mikhail\_Nikitin](https://forums.percona.com/u/Mikhail_Nikitin)\
**Post date:** [April 4, 2023, 2:04pm UTC](https://forums.percona.com/t/xtrabackup-prepare-consumes-high-amounts-of-memory/21180/1 "2023-04-04T14:04:58Z")

</div>

Hello,

After upgrading to mysql 8.0.25 from 5.7.31, xtrabackup --prepare consumes high amounts of memory for databases with many tables.

Options like `--use-memory` does not make any difference.  
Number of tables is around 1-2 millions.

For example with `--use-memory 256M` argument for a server with 400 000 tables (each in a separate file) xtrabackup consumes around 8Gi of memory.  
When number of tables is close to 1 000 000, it consumes more than 20Gi of memory.

Is it expected? With mysql 5.7 `--use-memory` argument worked fine, and memory consumptions was close it.

---

<div class="post-metadata">

**Author:** ![Marcelo\_Altmann](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/marcelo_altmann/32/11299_2.png) [@Marcelo\_Altmann](https://forums.percona.com/u/Marcelo_Altmann)\
**Post date:** [April 4, 2023, 4:50pm UTC](https://forums.percona.com/t/xtrabackup-prepare-consumes-high-amounts-of-memory/21180/2 "2023-04-04T16:50:02Z")

</div>

Hi @Mikhail_Nikitin . Thanks for your request.  
We are reworking the way xtrabackup opens tables for it to be smart regarding memory footprint.  
The behavior you are seeing is aligned with some internal research. We plan to land a new data dictionary cache functionality in the next release of xtrabackup. You can subscribe to [[PXB-2955] Implement dictionary table cache - Percona JIRA](https://jira.percona.com/browse/PXB-2955) to get updates when this work is released.

---

<div class="post-metadata">

**Author:** ![satya.bodapati](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/satya.bodapati/32/1322_2.png) [@satya.bodapati](https://forums.percona.com/u/satya.bodapati)\
**Post date:** [December 5, 2023, 6:09pm UTC](https://forums.percona.com/t/xtrabackup-prepare-consumes-high-amounts-of-memory/21180/3 "2023-12-05T18:09:27Z")

</div>

PXB-2955 is completed and released as part PXB 8.0.33-28
