Database too large to sync

I have only one deck with about 155K cards and an extremely extensive review history. Yesterday I got this error when trying to sync:

Blockquote
" Your collection file is too large to send to AnkiWeb. You can reduce its size by removing any unwanted decks (optionally exporting them first), and then using Check Database to shrink the file size down. (⁨252MB > 250MB⁩)"

The last time this happened, about a year ago, I followed the steps found in an AnkiMobile archive topic called “Deck Too Large” to delete my review history pre-2016, and that worked fine. (Won’t let me include link here.)

I tried to do that again to delete another year’s worth of review history, but I’m getting errors when I try to run the code in the debug console. Running the code as written in that thread (with the different number for the epoch) gives me this error:

Blockquote `>>> mw.col.db.execute(“delete from revlog where id < 1451624400000”)
… mw.col.modSchema(False)
:2:‘modSchema’ is deprecated: please use ‘mod_schema’

And then when I adjust modSchema to mod_schema, this is what happens:

Blockquote>>> mw.col.db.execute(“delete from revlog where id < 1451624400000”)
… mw.col.mod_schema(False)
< no output >

When I check database at this point and try to upload, I continue getting the “too large to sync” error.

Help, please?

2 Likes

Currently, there is a hard limit reasonable enough for most users to prevent abusive usages of a freely-provided “cloud” service. However, for users like you, who have a legit usage of this service, maybe this hard limit can be uplifted a bit by asking @dae.

Otherwise, you can also self host an anki syncing service. I’m not sure the sync server code is fully available, but there is a community version that seems to be working reliably. However, hardware server would be at your expenses. I think you can rent a server from something like 5$/month for a fully dedicated virtual server, but that would require some familiarity with computers…

4 Likes

Ooh, I have in-house tech support that would be sufficient for this sort of purpose. I may just do that!

1 Like


The database too large is the one highlighted above. A simple cure is deleting your decks and then run check database command to update the database file until it shrink back to below 250MB.

But I don’t want to delete my notes! Look inside your notes, use find and replace command to delete unneccesary words. There’s no need to delete sound and images, they are not words and do not count in database.

But I just have too many notes and no unnecessary words to delete, well export some decks first and then delete them, and then use the check database command to shrink the database back until less than 250MB, and then you can run the sync command. After sync is completed, re-import the deleted decks. Resync again. Problem solved.

This happen everytime you do hard full sync. So try to do less work on things require full sync.

1 Like

Hmm. I only have one deck, so I don’t know that the delete → check → re-import would work in this case. I use this one deck on two devices (desktop + tablet), which means syncing (usually multiple times per day) is essential for my workflow.

I can certainly do some tightening up of verbiage, especially on older cards from before I really knew what I was doing, but that seems like a stopgap, I think? Looking at my files, the size of my backup is 103.6 MB, but the size of my collection.anki2 file is 265 MB. If I’m interpreting this right, I think this means most of what’s putting me over the size limits is review history. (I’m coming up on three million reviews, I don’t know what the normal size of that amount of review history would be.)

Wow, three million reviews…I am not sure the review history is also stored in the database, but even it is, three million reviews+103.6MB should not exceed 250MB. If my thinking is correct, you can do this to check: export your whole collection without exporting media files or review history, and then compare the apkg size to the database file.

Looks like the .apkg size for this deck is 130.3 MB. I think this does include media files (I’m not sure how to exclude data on an export on Mac) but I don’t have a ton of that.

But honestly no matter what, if this too large message appears, the solution is as mentioned above.

1 Like

Removing up until about 5.5 years ago then running check DB brings it down to 240MB:

mw.col.db.execute("delete from revlog where id < ?", 1451624400000 + 2*365*86400000)

You might want to consider removing an extra year to give yourself some breathing room. As mentioned on the previous thread, you might want to export a backup of your collection first if you wish to retain the old history somewhere.

3 Likes

Thanks! We looked into the custom sync server but I’m on iOS, so I did end up deleting some history. C’est la vie. Thank you very much for the assistance.

The record of 2017 appears in my database, but I haven’t used Anki yet.

1451624400000 86400000? //How to delete those before a specific date, such as 900 days ago?:face_with_spiral_eyes:

Replace all those numbers with the desired epoch from https://www.epochconverter.com/, multiplied by 1000

2 Likes