err:user:unprocessable_entity:query_memory_limit_exceededExample
What happened?
Your query exceeded its workspace memory quota or produced an encoded response larger than 4 MiB. Unkey limits both values to prevent one analytics query from exhausting shared resources. The response limit applies to the encoded JSON size, not only the number of rows. A query can exceed it with one large aggregate value, many projected columns, or many rows.How to fix it
1. Return fewer columns and values
Select only the columns you need. Avoid aggregates such asgroupArray that can place an unbounded amount of data into one result value.
2. Use aggregations instead of raw data
Instead of fetching all rows, aggregate the data:3. Add more filters
Reduce the amount of data the query needs to process:4. Limit result size
Add aLIMIT to cap the number of returned rows. If the response still exceeds 4 MiB, lower the limit or select fewer columns.
5. Avoid large GROUP BY cardinality
GROUP BY on high-cardinality columns (likekey_id) uses a lot of memory. Instead, group by lower-cardinality columns:
Need a higher memory quota?
Contact support if your query has a legitimate need for a higher workspace memory quota. The 4 MiB encoded-response limit is fixed, so larger result sets must be split into multiple queries.Reach out to support and tell us:
- What you’re trying to analyze
- Why the query needs a higher memory quota
- An example of the query you’re running