Database Maintenance Best Practices

MnemoDeck stores all your decks, cards, tags, quiz history, and settings in a single database file. This page explains how MnemoDeck keeps that database healthy automatically, what the manual maintenance tools do, and best practices for long-term data safety.

What MnemoDeck Does Automatically

Most users never need to think about database maintenance. MnemoDeck performs the following operations in the background:

What Happens When Why It Matters
Quick integrity check Every time you open the app Catches file damage early, before you start working
Search index optimisation After importing a deck and when you close the app Keeps card searches fast, especially after large imports
Query statistics update When you close the app Helps the database choose the fastest way to look up your data
Write-ahead log cleanup When you close the app Merges pending changes into the main file for a clean shutdown
Incremental space reclaim When you close the app (after first manual compact) Gradually reclaims small amounts of unused space each session

All of these run in under a second and never delay you from closing the app. If you force-close MnemoDeck or your computer loses power, nothing is lost — the database recovers automatically on the next launch.

Manual Maintenance Tools

These tools are available in Settings > Database Maintenance:

Check Database Health

A deeper check than the automatic one at startup. Verifies every row matches every index and checks for orphaned references between tables. Use it before important backups or after a crash.

See Options > Database Maintenance for full details.

Compact Database

Rebuilds the database file to reclaim space from deleted content. Most useful after deleting large decks. After the first compact, MnemoDeck enables automatic incremental compaction so small amounts of space are reclaimed at every shutdown.

See Options > Database Maintenance for full details.

Best Practices for Data Safety

Follow these tips to keep your data safe long-term:

Understanding the Database File

File location

Your database is stored at %LocalAppData%\MnemoDeck\mnemodeck.db. You can paste this path into File Explorer’s address bar to navigate there.

Companion files

You may see mnemodeck.db-wal and mnemodeck.db-shm alongside the main file. These are temporary files used by the database engine for performance. They are cleaned up when MnemoDeck shuts down normally. Do not delete them while the app is running.

File size

The database file grows as you add content. A typical database with 10 decks and 500 cards is around 1–3 MB. Images embedded in card content can increase the size significantly.

Troubleshooting

Common scenarios and what to do:

Symptom Likely Cause What to Do
“Database may be corrupted” warning at startup File damage from crash, disk error, or antivirus interference Run Check Database Health from Settings for a detailed report. If issues are found, restore from your most recent backup via Settings > Backup & Restore.
Database file is much larger than expected Accumulated space from deleted decks/cards Run Compact Database from Settings.
Searches return unexpected results Stale or fragmented search index Close and reopen MnemoDeck (the automatic search optimisation runs at shutdown). If the problem persists, run Check Database Health.
App is slow to open after a crash Large unprocessed write-ahead log This is normal — the database replays pending changes on the first open after an unclean shutdown. It resolves itself automatically.
-wal and -shm files remain after closing App was force-closed or crashed Safe to ignore. They will be cleaned up on the next normal app launch. Do not delete them manually.