# Deleting media from Central submissions - does it reduce database size

**URL:** <https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321>\
**Category:** Support\
**Created:** [June 5, 2024, 6:25pm UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321 "2024-06-05T18:25:38Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![seewhy](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/seewhy/32/3199_2.png) [@seewhy](https://forum.getodk.org/u/seewhy)\
**Post date:** [June 5, 2024, 6:25pm UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/1 "2024-06-05T18:25:38Z")

</div>

**1. What is the issue? Please be detailed.**  
I am trying to tidy up my Central install and reduce its overall size. I have a few thousand images associated with different forms and I intend to use the API functionality to do this:

> **[Submission Management](https://docs.getodk.org/central-api-submission-management/#clearing-a-submission-attachment)**
>
> Submissions: Listing all Submissions on a Form: GET /v1/projects/{projectId}/forms/{xmlFormId}/submissions Request Parameters,, projectId, number Example: 16,, xmlFormId, string Example: simple,,,,...

My question is whether this will release any space within the database, and if not, is there a TRUSTED way of reducing the database size / allocation?

I am also using Borg backup l for the backup of Central, and getting close to my current cloud storage limits for this aspect, so would also be useful as a means of avoiding increasing costs if I can remove media and their associated space from each repository going forward (I know the monthly additional costs are not huge, but it all adds up, and I'm conscious of the carbon footprint associated with all this data I have floating around!)

**2. What steps can we take to reproduce this issue?**

**3. What have you tried to fix the issue?**  
I haven't tried this yet, but have all my preparations in place!

---

<div class="post-metadata">

**Author:** ![ktuite](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ktuite/32/14766_2.png) [@ktuite](https://forum.getodk.org/u/ktuite)\
**Post date:** [June 13, 2024, 10:46pm UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/2 "2024-06-13T22:46:47Z")

</div>

Hi @seewhy,

For your specific scenario, I believe this should work, though maybe not for the reason you think. It also may take ~24 hrs for you to see the size reduction. This is what will happen under the hood when you DELETE a submission attachment via the API: the data will continue be stored in the database as a blob, but that blob will be unlinked from the submission attachment record. Then a daily cron job for purging deleted forms that have been in the trash for 30 days will do its work and also remove any unattached blobs, including the submission attachment blobs. You could also run that form purging script manually. Everything else should still function because Central is robust to missing submission attachments.

Just be aware that if you delete these attachments, even before they are purged from the database, it wont really be possible to get them back! So proceed with caution!

We are also actively working on ways to reduce storage size in Central, including:

- making it possible to store blobs outside of the database
- working on full submission deletion

---

<div class="post-metadata">

**Author:** ![seewhy](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/seewhy/32/3199_2.png) [@seewhy](https://forum.getodk.org/u/seewhy)\
**Post date:** [June 14, 2024, 9:03am UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/3 "2024-06-14T09:03:54Z")

</div>

Hi @ktuite  
Thanks for that confirmation and the caveats - really helpful to 'understand' what might be going on under the hood with the blobs.

I'm assuming that the daily cron script is already running (not something I should have set up?) - would it be wise for me to know a manual purging script? Or am I best left in the dark with that comfort that Central is doing its stuff?

You can probably tell how cautious I am with submissions by having posted on the forum _before_ trying it (I know, very un-male of me!) - I have ensured I have local copies of attachments as well as the cloud back ups... Still hesitating 🙂 - I have a redundant form that has some attachments so that's top of my list...

Appreciate the support.

---

<div class="post-metadata">

**Author:** ![ktuite](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ktuite/32/14766_2.png) [@ktuite](https://forum.getodk.org/u/ktuite)\
**Post date:** [June 19, 2024, 2:15am UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/4 "2024-06-19T02:15:04Z")

</div>

The daily cron job that purges long-ago deleted forms is already running, yes. Nothing extra that you need to do!

---

<div class="post-metadata">

**Author:** ![manghig](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/manghig/32/11609_2.png) [@manghig](https://forum.getodk.org/u/manghig)\
**Post date:** [September 15, 2025, 12:22pm UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/5 "2025-09-15T12:22:14Z")

</div>

> [@ktuite](#):
>
> We are also actively working on ways to reduce storage size in Central, including:
> 
> - making it possible to store blobs outside of the database
> - working on full submission deletion

@ktuite Dear ktuite, what is the development/implementation status of this new functionalities? Thanks in advance, regards.

---

<div class="post-metadata">

**Author:** ![yanokwa](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/yanokwa/32/1695_2.png) [@yanokwa](https://forum.getodk.org/u/yanokwa)\
**Post date:** [September 15, 2025, 5:55pm UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/6 "2025-09-15T17:55:17Z")

</div>

Blob storage shipped in [Central v2024.2](https://forum.getodk.org/t/odk-central-v2024-2-submission-deletes-via-api-and-s3-media-storage/49742). See the docs on [using S3-compatible storage](https://docs.getodk.org/central-install-digital-ocean/#central-install-digital-ocean-s3) for more.

---

<div class="post-metadata">

**Author:** ![ktuite](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ktuite/32/14766_2.png) [@ktuite](https://forum.getodk.org/u/ktuite)\
**Post date:** [January 20, 2026, 8:44pm UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/7 "2026-01-20T20:44:47Z")

</div>

@manghig

I wanted to clarify that when I mentioned "deleting" a submission attachment via the API, I meant the same thing as "clearing" an attachment. See API docs for [Clearing a Submission Attachment](https://docs.getodk.org/central-api-submission-management/#clearing-a-submission-attachment) (which is done with a DELETE request).

Under the hood, this will unlink the blob that stores the data for that attachment. The data will still exist in the DB taking up space until the daily purge cron job. The cleared submission attachment blobs should be _deleted_ from the DB at that time. The 30 day wait period shouldn't apply because the purge script just removes any and all "unattached" blobs.

The only way some blobs may not be deleted is if they are shared, e.g. the same file with the exact same contents was somehow uploaded for two separate attachments, and were stored by the same blob. If only one of the attachments was cleared but the other remained, then the blob would not be deleted by the purge script.

---

<div class="post-metadata">

**Author:** ![ktuite](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ktuite/32/14766_2.png) [@ktuite](https://forum.getodk.org/u/ktuite)\
**Post date:** [January 20, 2026, 10:43pm UTC](https://forum.getodk.org/t/deleting-media-from-central-submissions-does-it-reduce-database-size/47321/8 "2026-01-20T22:43:30Z")

</div>

We just discovered that if submissions have been _edited_, this technique of clearing the attachment to free up space does not work. The "clear attachments" API only works on the current version of the submission.
