# When do notes get purged from database?

**URL:** <https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391>\
**Category:** Support\
**Created:** [24 June 2023 04:43 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391 "2023-06-24T04:43:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![DBDigital](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DBDigital](https://discourse.joplinapp.org/u/DBDigital)\
**Post date:** [24 June 2023 04:43 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391/1 "2023-06-24T04:43:43Z")

</div>

When do deleted notes get purged from database? I have read the method for restoring a deleted note using the restoreNoteRevision command. But seeing how this is available to note history, I assume when it is past how long you keep your note history for, it will purge the items from the database?

Or is everything retained and the database only grows and i should export everything, delete database and reimport on a semi regular basis?

How about attachments? When do they get zapped locally?

How about on a sync target? This I assume depends on the sync target in question and if it retains any of the files once deleted.

---

<div class="post-metadata">

**Author:** ![DBDigital](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DBDigital](https://discourse.joplinapp.org/u/DBDigital)\
**Post date:** [15 July 2023 17:25 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391/2 "2023-07-15T17:25:28Z")

</div>

No one knows?

---

<div class="post-metadata">

**Author:** ![ajay](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/ajay/32/6551_2.png) [@ajay](https://discourse.joplinapp.org/u/ajay)\
**Post date:** [19 July 2023 07:30 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391/3 "2023-07-19T07:30:43Z")

</div>

My best shot: past the note history date, the note is most likely gone. The attachment is still in the DB and can be found through the tools menu.

---

<div class="post-metadata">

**Author:** ![DBDigital](https://avatars.discourse-cdn.com/v4/letter/d/df705f/32.png) [@DBDigital](https://discourse.joplinapp.org/u/DBDigital)\
**Post date:** [23 July 2023 19:09 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391/4 "2023-07-23T19:09:36Z")

</div>

Attachments aren't deleted unless I delete them from the tools menu? How do I tell which is linked to a now deleted note? I have a bunch that only say "untitled" with the size and ID. I assume there is a way to easily look up which ones could be purged?

---

<div class="post-metadata">

**Author:** ![personalizedrefriger](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/personalizedrefriger/32/13210_2.png) [@personalizedrefriger](https://discourse.joplinapp.org/u/personalizedrefriger)\
**Post date:** [23 July 2023 20:57 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391/5 "2023-07-23T20:57:33Z")

</div>

I think attachments are auto-deleted.

See

- [The tests related to deleting unreferenced resources.](https://github.com/laurent22/joplin/blob/3bd04aeaf45fa105b08d589b4580e0db8e11acd6/packages/lib/services/ResourceService.test.ts)
- [A question about setting the delay before auto-deleting unreferenced resources](https://discourse.joplinapp.org/t/setting-the-delay-before-deletion-of-orphan-resources/210/2)
- [A GitHub discussion about an old (now closed) issue in the resource deletion logic](https://github.com/laurent22/joplin/issues/932#issuecomment-933736405)

---

<div class="post-metadata">

**Author:** ![ajay](https://yyz2.discourse-cdn.com/flex028/user_avatar/discourse.joplinapp.org/ajay/32/6551_2.png) [@ajay](https://discourse.joplinapp.org/u/ajay)\
**Post date:** [25 July 2023 07:32 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391/6 "2023-07-25T07:32:49Z")

</div>

I have frequently found attachments from "old notes" in the list of attachments. It is possible that this has changed with improvements of Joplin over time. I cannot tell.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex028/uploads/cozic/original/3X/1/c/1c948e33314e232a0927789508474d8624f4270b.png) [@system](https://discourse.joplinapp.org/u/system)\
**Post date:** [24 August 2023 07:33 UTC](https://discourse.joplinapp.org/t/when-do-notes-get-purged-from-database/31391/7 "2023-08-24T07:33:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
