Querying _creationTime range in large table
What are the suggested patterns for querying a large table by _creationTime?
I would like to specify a startTime and endTime but my current query still iterates over the whole table, which exceeds the limit and throws an error.
3 Replies
i think you can do
await db.query("table").withIndex("by_creation_time", q => q.gt("_creationTime", lowerBound).lt("_creationTime", upperBound)),collect()
worked like a charm, thanks!
It's kinda buried but this built-in index is documented at the end of this doc:
https://docs.convex.dev/database/indexes/
Indexes | Convex Developer Hub
Indexes are a data structure that allow you to speed up your