This is an automated email from the ASF dual-hosted git repository.

dspavlov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/master by this push:
     new cb77103b3b2 IGNITE-28651 Document Calcite SQL memory quotas in Ignite 
2.x documentation (#13113)
cb77103b3b2 is described below

commit cb77103b3b27309821645e9d5cd0afe567a49c69
Author: ignitetcbot <[email protected]>
AuthorDate: Thu May 7 17:48:26 2026 +0300

    IGNITE-28651 Document Calcite SQL memory quotas in Ignite 2.x documentation 
(#13113)
    
    Thank you for submitting the pull request to the Apache Ignite.
    
    In order to streamline the review of the contribution
    we ask you to ensure the following steps have been taken:
    
    ### The Contribution Checklist
    - [ ] There is a single JIRA ticket related to the pull request.
    - [ ] The web-link to the pull request is attached to the JIRA ticket.
    - [ ] The JIRA ticket has the _Patch Available_ state.
    - [ ] The pull request body describes changes that have been made.
    The description explains _WHAT_ and _WHY_ was made instead of _HOW_.
    - [ ] The pull request title is treated as the final commit message.
    The following pattern must be used: `IGNITE-XXXX Change summary` where
    `XXXX` - number of JIRA issue.
    - [ ] A reviewer has been mentioned through the JIRA comments
    (see [the Maintainers
    
list](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute#HowtoContribute-ReviewProcessandMaintainers))
    - [ ] The pull request has been checked by the Teamcity Bot and
    the `green visa` attached to the JIRA ticket (see tab `PR Check` at
    [TC.Bot - Instance 1](https://tcbot2.sbt-ignite-dev.ru/prs.html) or
    [TC.Bot - Instance 2](https://mtcga.gridgain.com/prs.html))
    
    ### Notes
    - [How to
    
Contribute](https://cwiki.apache.org/confluence/display/IGNITE/How+to+Contribute)
    - [Coding abbreviation
    
rules](https://cwiki.apache.org/confluence/display/IGNITE/Abbreviation+Rules)
    - [Coding
    
Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Coding+Guidelines)
    - [Apache Ignite Teamcity
    
Bot](https://cwiki.apache.org/confluence/display/IGNITE/Apache+Ignite+Teamcity+Bot)
    
    If you need any help, please email [email protected] or ask anу
    advice on http://asf.slack.com _#ignite_ channel.
    
    ---------
    
    Co-authored-by: Dmitriy Pavlov <[email protected]>
---
 docs/Gemfile                    |  6 ++++-
 docs/_docs/SQL/sql-calcite.adoc | 56 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/docs/Gemfile b/docs/Gemfile
index 995be7b2587..c15a82fe076 100644
--- a/docs/Gemfile
+++ b/docs/Gemfile
@@ -4,7 +4,7 @@ source "https://rubygems.org";
 
 gem 'asciidoctor'
 gem 'jekyll', group: :jekyll_plugins
-gem 'wdm', '~> 0.1.1' if Gem.win_platform?
+# gem 'wdm', '~> 0.1.1' if Gem.win_platform?
 group :jekyll_plugins do
   gem 'jekyll-asciidoc'
   gem 'jekyll-sass-converter', '~> 2.2'
@@ -13,6 +13,10 @@ end
 gem 'thread_safe', '~> 0.3.6'
 gem 'slim', '~> 4.0.1'
 gem 'tilt', '~> 2.0.9'
+gem 'bigdecimal', '~> 4.1'
+gem 'base64', '~> 0.3'
+gem 'csv', '~> 3.3'
+gem 'logger', '~> 1.7'
 
 # Ruby 3.0.0 requires dependency which doesn't contains in the bundle
 gem "webrick", "~> 1.7"
diff --git a/docs/_docs/SQL/sql-calcite.adoc b/docs/_docs/SQL/sql-calcite.adoc
index 504080d9e9b..2cc6c2b477a 100644
--- a/docs/_docs/SQL/sql-calcite.adoc
+++ b/docs/_docs/SQL/sql-calcite.adoc
@@ -121,6 +121,62 @@ QUERY_ENGINE=CALCITE
 ----
 --
 
+== Memory Quotas [[memory-quotas]]
+
+The Calcite-based SQL engine can track and limit heap memory accounted by 
Calcite query execution operators.
+This is useful for protecting a server node from a single large query or from 
many concurrent memory-heavy queries.
+
+Two types of quotas can be configured in `CalciteQueryEngineConfiguration`:
+
+* `globalMemoryQuota` - a per-node heap memory quota for all Calcite SQL 
queries running on the node.
+* `queryMemoryQuota` - a per-node heap memory quota for each Calcite SQL query 
running on the node.
+
+Both quotas are disabled by default (`0`).
+The quota values are specified in bytes.
+If a quota is exceeded, the query fails with an exception.
+The global quota error message contains `Global memory quota for SQL queries 
exceeded`, and the per-query quota error message contains `Query quota 
exceeded`.
+
+The quota is applied to query execution structures that keep rows in heap 
memory, for example sorting, hash joins, hash aggregates, set operations, 
collection operations, spools, and result materialization.
+It is not a process memory limit and it does not account for Ignite data 
regions, direct memory, JVM native memory, or the operating system page cache.
+The quotas are per-node.
+For a distributed query, total memory consumption across the cluster can be 
higher because the limit is applied independently on every participating node.
+Size these quotas together with `-Xmx` and the expected SQL concurrency.
+
+[tabs]
+--
+tab:XML[]
+[source,xml]
+----
+<bean class="org.apache.ignite.configuration.IgniteConfiguration">
+    <property name="sqlConfiguration">
+        <bean class="org.apache.ignite.configuration.SqlConfiguration">
+            <property name="queryEnginesConfiguration">
+                <list>
+                    <bean 
class="org.apache.ignite.calcite.CalciteQueryEngineConfiguration">
+                        <property name="default" value="true"/>
+                        <property name="globalMemoryQuota" value="#{4L * 1024 
* 1024 * 1024}"/>
+                        <property name="queryMemoryQuota" value="#{512L * 1024 
* 1024}"/>
+                    </bean>
+                </list>
+            </property>
+        </bean>
+    </property>
+</bean>
+----
+tab:Java[]
+[source,java]
+----
+IgniteConfiguration cfg = new IgniteConfiguration().setSqlConfiguration(
+    new SqlConfiguration().setQueryEnginesConfiguration(
+        new CalciteQueryEngineConfiguration()
+            .setDefault(true)
+            .setGlobalMemoryQuota(4L * 1024 * 1024 * 1024)
+            .setQueryMemoryQuota(512L * 1024 * 1024)
+    )
+);
+----
+--
+
 == SQL Reference
 
 === DDL

Reply via email to