When running the following query I got the error:
Resources exceeded during query execution: The query could not be executed in the allotted memory. Peak usage: 158% of limit. Top memory consumer(s): sort operations used for analytic OVER() clauses: 98% other/unattributed: 2%
select *, row_number() over(PARTITION BY Column_A ORDER BY Column_B)
from
(SELECT
*
FROM
Table_1 UNION ALL
SELECT
*
FROM
Table_2 UNION ALL
SELECT
*
FROM
Table_3
)
Can someone help me how to change this query or is there possibility that we can change the memory limit in bigquery?
Maximum of 100,000 rows - BigQuery datasets exceeding the maximum number of rows will be truncated. Partitioned tables are not supported - Any BigQuery tables that have partitioned columns will report an error during configuration in AppSheet.
BigQuery generally does not limit the number of concurrent INSERT DML statements that write to a single table.
Directly process unstructured data using BigQuery ML Object tables contain metadata such as URI (Uniform Resource Identifier), content type, and size that can be queried just like other BigQuery tables. You can then derive inferences using machine learning models on unstructured data with BigQuery ML.
Welcome Aaron,
This error means BigQuery is unable to process the whole query due to memory limits, the ORDER BY
function is pretty memory intensive, try removing it and I would expect your query to run fine.
If you need results ordered, try writing the unordered query out to a table then running a new query on this table to order the results.
If you're interested. here's an interesting article on how and BigQuery executes in memory: https://cloud.google.com/blog/products/gcp/in-memory-query-execution-in-google-bigquery
I don't believe you can override or change this memory limit, but happy to be proven wrong.
Make sure your ORDER BY
is being executed in real last step, additionally, consider to use a LIMIT
clause to avoid “Resources Exceeded” or “Response too large” fails.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With