Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
All solutions
    • All solutions for Managed Service for ClickHouse®
    • Resolving the `Exception Memory limit (total) exceeded` error when running a query
    • How to set `max_execution_time`

In this article:

  • Issue description
  • Solution
  • If the issue persists
  1. Managed Service for ClickHouse®
  2. Resolving the `Exception Memory limit (total) exceeded` error when running a query

Fixing the Exception Memory limit (total) exceeded error when running a query

Written by
Yandex Cloud
Updated at December 17, 2025
  • Issue description
  • Solution
  • If the issue persists

Issue descriptionIssue description

When running a ClickHouse® query, you get this error:

DB::Exception: Memory limit (total) exceeded: would use XX.XX GiB (attempt to allocate chunk of ******** bytes), maximum: **.* GiB. (MEMORY_LIMIT_EXCEEDED), Stack trace (when copying this message, always include the lines below)

SolutionSolution

This error indicates that the database query size exceeds the user RAM limit. You can increase this limit on the Users tab in your management console by editing the max_memory_usage parameter.

Warning

The max_memory_usage limit value must not exceed that of max_server_memory_usage.

If user management via SQL is enabled in the cluster, you can set this parameter:

  • At the session level, via set max_memory_usage.
  • For all users by default, by creating one settings profile.

If the issue persistsIf the issue persists

If the above actions did not help, create a support ticket. Provide the following information in your ticket:

  1. Yandex Managed Service for ClickHouse® cluster ID.
  2. Database query code.
  3. Full text of the error message.

Was the article helpful?

Previous
All solutions for Managed Service for ClickHouse®
Next
How to set `max_execution_time`
© 2025 Direct Cursus Technology L.L.C.