query - does convex expose any low level info(documents scanned, etc) per a given query?
I currently have a query doing 16mb on an indexed table. Does convex expose any low-level metrics per queries? There's some form of detailing on the dashboard, but it's aggregated and hard to isolate.
Secondly, I'm aware queries are reactive, but is there any public documentation on what determines the triggers for this reactivity? In simpler terms, for a given query, What is the sync engine looking at? What counts as a trigger?
4 Replies
What kind of query metrics are you looking for? If you scroll down on the dashboard details, it gets a little more granular, but I'm not sure what exactly you want.
As for query triggers, my understanding is that it's any change on any document returned by the query, including new documents that match the query criteria.
>What kind of query metrics are you looking for? If you scroll down on the dashboard details, it gets a little more granular, but I'm not sure what exactly you want.
This result may return 10 documents, but it's possible it scanned 200 documents. is there anyway to specifically extract this 200 value from the query result? (instantly & programmatically)
>As for query triggers, my understanding is that it's any change on any document returned by the query, including new documents that match the query criteria.
This is probably a dumb question, but if i have a 1 main query that contains 4 nested queries, and a custom response, what does it look like in this case?
First off, the structure of your query isn't using the index correctly. The second argument for
.withIndex should be an arrow function. I recommend reviewing the index docs to see the correct syntax.
This result may return 10 documents, but it's possible it scanned 200 documents. is there anyway to specifically extract this 200 value from the query result? (instantly & programmatically)The only way that I can think of would be to use
.collect() after .withIndex. You could count the collected documents, use a normal JS filter to narrow down the documents to return, then return both the scan count and the filtered docs.Indexes | Convex Developer Hub
Speed up queries with database indexes
This is probably a dumb question, but if i have a 1 main query that contains 4 nested queries, and a custom response, what does it look like in this case?Can you provide an example? I can't quite picture what you're talking about.