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:
- Back up regularly. The single most important thing you can do. Use Settings > Backup & Restore to create backups. See Backup & Restore.
- Enable backup reminders. In Options > Backup & Data Safety, turn on reminders so MnemoDeck nudges you when it has been too long. See Backup Reminder.
- Let the app close normally. MnemoDeck performs housekeeping when you close it (optimising searches, cleaning up temporary files). Using the X button or Alt+F4 is fine. Avoid force-closing from Task Manager unless the app is unresponsive — even then, no data is lost, but the housekeeping is skipped.
- Compact after large deletes. If you delete a deck with hundreds of cards, consider running Compact Database from Settings to shrink the file. This is optional — MnemoDeck works fine without it.
- Run a health check before important backups. Before creating a backup you plan to keep long-term (e.g., before reinstalling Windows), run Check Database Health from Settings to confirm everything is consistent.
- Don’t manually edit the database file. The database file (
mnemodeck.db) and its companion files (-wal,-shm) in your AppData folder are managed by the app. Editing, moving, or deleting them while MnemoDeck is running can cause data loss. - Keep one version of MnemoDeck at a time. Running multiple different versions against the same database file can cause schema conflicts. Always update to the latest version.
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. |