How to store long lists in Convex DB, i.e. a user's known foreign words?
My app has an aspect of reading comprehension assistance for foreign languages. It shows word-level translations for foreign language text. My app shouldn't show a translation for a given foreign word if a user already knows it.
I am trying to store a user's "known words" for a given language. That list can get pretty long: a typical American 8th grader would know ~25,000 English words.
Looking at the documentation, there's some database limits that I don't know how to accommodate:
1) Number of documents scanned in a query: 16,384
2) The column data type, Arrays, can have at most 8192 values.
3) The column data type, Objects can have at most 1024 entries.
3 Replies
Also, could you expound on this sentence: number of documents scanned in a query
Based on my current interpretation, a query with a filter would fail on a table with more than 16,384 documents
Another interpretation is that an indexed column wouldn’t have a full table scan, and so less document scans
Yes, filters scan the whole table, indexes scan only the index range you select.
I imagine you want
{ userId: v.id("users"), word: v.string() }
table, and a compound index on both the userId
and the word
.Okay thanks Michal!