Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion docs/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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"
56 changes: 56 additions & 0 deletions docs/_docs/SQL/sql-calcite.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down