Select specific db columns on server (bytes execution limit)
The following code in convex/lead.ts:
Is it possible to select only the columns (fields) I want in the db query? An SQL analogy would be:
7 Replies
It's not possible.
Given your other question, I wonder what the data looks like in your documents, and whether it would make sense to model it (normalize it) better before storing in the database?
Yes, I could do that.
I would prefer to not specify too much of the data's structure (i.e. normalise), as we haven't solidified on a schema/solution.
With the validation off, I could pull apart the locations from the rest of the data (not sure if that counts as normalisation as it's 1 to 1) as that seems like the only way.
Does pagination work for your usecase? That'd be the most scalable approach
Unfortunately pagination won't work, I need all the rows, but only two columns.
(You can always accumulate the data from pagination on the client - but given you're running into this error, it will be a lot of data)
If it's run in a one-off context, you could paginate from an action and accumulate the results there before returning it all at once. I'm curious what usecase can't use pagination
Oh of course; as we're using a map, I assumed you meant paginate as the user moves around.
But you're 100% right, I could accumulate the results with multiple calls on page load.