Understanding Composite Query Instruction Limits on the Internet Computer

Hello everyone,

I’m currently working with the Internet Computer and facing an issue regarding instruction limits for composite queries. To give you some background, I’ve written a composite_query that calls two other queries via ic_cdk::api::call. Those other queries are also within the same canister as the composite_query. Individually, these queries stay within the 5 billion instruction limit. However, when combined in composite_query, the composite_query throws the instruction limit exceeded error.

The crux of my query is this: if composite_query were to call other canisters instead, would the computation within those calls be included in the instruction limit for composite_query?

@jennifertran suggested I initiate a new forum post to discuss this, as it might bring fresh perspectives, particularly from @ulan who might not see it if in the comments of the Composite Query Proposal.

I look forward to any insights or suggestions you might have.

5 Likes

All queries invoked from a composite query share the same 5B instruction limit. So it is not possible to do more work by splitting a query into multiple queries.

As I mentioned in another thread, the main blocker is that the canisters need to somehow pay for the work done in queries. @stefan-kaestle explains the problem of charging and potential solutions here: Community Consideration: Explore Query Charging

I think so far the discussion was about either enable query charging for all canister or none. Your suggestion of some opt-in mechanism sounds promising: a canister would indicate in canister settings that it is willing to pay for queries, then the system could increase the instruction limit for such canisters and start charging them.

Would you mind posting this suggestion in the query charging discussion?

How many instructions would you need per query?

6 Likes