# Best practices with state.vscdb and state.vscdb.backup in Cursor

**URL:** <https://forum.cursor.com/t/best-practices-with-state-vscdb-and-state-vscdb-backup-in-cursor/156848>\
**Category:** Discussions\
**Tags:** macos, performance\
**Created:** [April 6, 2026, 10:13pm UTC](https://forum.cursor.com/t/best-practices-with-state-vscdb-and-state-vscdb-backup-in-cursor/156848 "2026-04-06T22:13:21Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [April 7, 2026, 1:52pm UTC](https://forum.cursor.com/t/best-practices-with-state-vscdb-and-state-vscdb-backup-in-cursor/156848/4 "2026-04-07T13:52:59Z")

</div>

Hey, this is a known issue. The `cursorDiskKV` table inside `state.vscdb` keeps storing data from chats and agent sessions with no limit or cleanup. The team is aware, but there’s no ETA yet.

Here’s what you can do right now:

1. Try VACUUM, it helps if the DB is fragmented

Fully quit Cursor, then run in Terminal:

```sh
sqlite3 ~/Library/Application\ Support/Cursor/User/globalStorage/state.vscdb "VACUUM;"

```

If the size doesn’t change, it means the file is actually full of data, not just fragmented.

1. Cleanup via SQL, if VACUUM didn’t help

Make a backup first:

```sh
cp ~/Library/Application\ Support/Cursor/User/globalStorage/state.vscdb ~/Library/Application\ Support/Cursor/User/globalStorage/state.vscdb.manual-backup

```

Then run:

```sql
sqlite3 ~/Library/Application\ Support/Cursor/User/globalStorage/state.vscdb <<'SQL'
PRAGMA journal_mode=DELETE;
BEGIN IMMEDIATE;
DELETE FROM cursorDiskKV WHERE key LIKE 'agentKv:%';
DELETE FROM cursorDiskKV WHERE key LIKE 'bubbleId:%';
DELETE FROM cursorDiskKV WHERE key LIKE 'checkpointId:%';
COMMIT;
VACUUM;
SQL

```

This can shrink the file from 20 GB down to tens of MB. But note that chat history in the UI will disappear. Old chats may show an endless Loading Chat. The actual chat data isn’t deleted from `workspaceStorage`, the UI just won’t be able to find it. Agent transcripts will still be in `~/.cursor/projects/`.

The `state.vscdb.backup` file is an automatic backup created by Cursor. It should shrink on its own after the main file gets smaller.

More details and workaround discussion:

> [@Cursor state.vscdb growing at 1 GB in a day](https://forum.cursor.com/t/cursor-state-vscdb-growing-at-1-gb-in-a-day/151747):
>
> Where does the bug appear (feature/product)? Somewhere else… Describe the Bug I’ve used Cursor for 2 months. 3 weeks ago, (about 20 Jan) state.vscdb was 5 GB Yesterday morning (13 Feb, 10.00 am) state.vscdb was 7.27 GB Yesterday evening (13 Feb, 10.00 am) state.vscdb was 8.20 GB Growth of 1 GB in 12 hrs. Is this something like a DOS attack or worse? Steps to Reproduce I don’t know Expected Behavior vscdb shouldnt grow at this rate. Soon I will be out of hard drive space and wont be able …

Let me know if you have any questions about the process.

---

_[View the full topic](https://forum.cursor.com/t/best-practices-with-state-vscdb-and-state-vscdb-backup-in-cursor/156848)._
