GerhardG
Convex Community17mo ago
6 replies
Gerhard

efficiency of: return (await ctx.db.query("messages").collect()).length;

that does not seem very efficient if I had 1mil rows in a table.
Two suggestions/questions:
1. Is there a count of a table (without scanning the whole table)?
2. Alternatively, should there not a some for of projection?
What if I had a table with 50 columns and I need a list that really only contains 2 or 3 of the columns?

Am I going to get all 1M rows streamed into memory or somehow in order to get a count?
Was this page helpful?