blob: 65ba522731621b3cfeea675e94a9a72e6d884aed [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper plugin-docs plugin-id-default docs-version-current docs-doc-page docs-doc-id-querying/query-context-reference" data-has-hydrated="false">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v3.7.0">
<title data-rh="true">Query context reference | Apache® Druid</title><meta data-rh="true" name="viewport" content="width=device-width,initial-scale=1"><meta data-rh="true" name="twitter:card" content="summary_large_image"><meta data-rh="true" property="og:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" name="twitter:image" content="https://druid.apache.org/img/druid_nav.png"><meta data-rh="true" property="og:url" content="https://druid.apache.org/docs/latest/querying/query-context-reference"><meta data-rh="true" property="og:locale" content="en"><meta data-rh="true" name="docusaurus_locale" content="en"><meta data-rh="true" name="docsearch:language" content="en"><meta data-rh="true" name="docusaurus_version" content="current"><meta data-rh="true" name="docusaurus_tag" content="docs-default-current"><meta data-rh="true" name="docsearch:version" content="current"><meta data-rh="true" name="docsearch:docusaurus_tag" content="docs-default-current"><meta data-rh="true" property="og:title" content="Query context reference | Apache® Druid"><meta data-rh="true" name="description" content="&lt;!--"><meta data-rh="true" property="og:description" content="&lt;!--"><link data-rh="true" rel="icon" href="/img/favicon.png"><link data-rh="true" rel="canonical" href="https://druid.apache.org/docs/latest/querying/query-context-reference"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/querying/query-context-reference" hreflang="en"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/latest/querying/query-context-reference" hreflang="x-default"><link rel="stylesheet" href="/css/all.css">
<script src="/js/clipboard.min.js"></script><link rel="stylesheet" href="/assets/css/styles.f3140859.css">
<script src="/assets/js/runtime~main.55f4649c.js" defer="defer"></script>
<script src="/assets/js/main.3bc88d52.js" defer="defer"></script>
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){try{return new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}}()||function(){try{return window.localStorage.getItem("theme")}catch(t){}}();t(null!==e?e:"light")}(),function(){try{const n=new URLSearchParams(window.location.search).entries();for(var[t,e]of n)if(t.startsWith("docusaurus-data-")){var a=t.replace("docusaurus-data-","data-");document.documentElement.setAttribute(a,e)}}catch(t){}}()</script><div id="__docusaurus"><div role="region" aria-label="Skip to main content"><a class="skipToContent_fXgn" href="#__docusaurus_skipToContent_fallback">Skip to main content</a></div><nav aria-label="Main" class="navbar navbar--fixed-top navbar--dark"><div class="navbar__inner"><div class="navbar__items"><button aria-label="Toggle navigation bar" aria-expanded="false" class="navbar__toggle clean-btn" type="button"><svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><a class="navbar__brand" href="/"><div class="navbar__logo"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedComponent_mlkZ themedComponent--dark_xIcU"></div></a></div><div class="navbar__items navbar__items--right"><a class="navbar__item navbar__link" href="/technology">Technology</a><a class="navbar__item navbar__link" href="/use-cases">Use Cases</a><a class="navbar__item navbar__link" href="/druid-powered">Powered By</a><a class="navbar__item navbar__link" href="/docs/latest/design/">Docs</a><a class="navbar__item navbar__link" href="/community/">Community</a><div class="navbar__item dropdown dropdown--hoverable dropdown--right"><a href="#" aria-haspopup="true" aria-expanded="false" role="button" class="navbar__link">Apache®</a><ul class="dropdown__menu"><li><a href="https://www.apache.org/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Foundation<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://apachecon.com/?ref=druid.apache.org" target="_blank" rel="noopener noreferrer" class="dropdown__link">Events<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/licenses/" target="_blank" rel="noopener noreferrer" class="dropdown__link">License<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/thanks.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Thanks<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/security/" target="_blank" rel="noopener noreferrer" class="dropdown__link">Security<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li><li><a href="https://www.apache.org/foundation/sponsorship.html" target="_blank" rel="noopener noreferrer" class="dropdown__link">Sponsorship<svg width="12" height="12" aria-hidden="true" viewBox="0 0 24 24" class="iconExternalLink_nPIU"><path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"></path></svg></a></li></ul></div><a class="navbar__item navbar__link" href="/downloads/">Download</a><div class="navbarSearchContainer_Bca1"><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon" tabindex="0"></span><input id="search_input_react" type="search" placeholder="Loading..." aria-label="Search" class="navbar__search-input search-bar" disabled=""></div></div></div></div><div role="presentation" class="navbar-sidebar__backdrop"></div></nav><div id="__docusaurus_skipToContent_fallback" class="main-wrapper mainWrapper_z2l0"><div class="docsWrapper_hBAB"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docRoot_UBD9"><aside class="theme-doc-sidebar-container docSidebarContainer_YfHR"><div class="sidebarViewport_aRkj"><div class="sidebar_njMd"><nav aria-label="Docs sidebar" class="menu thin-scrollbar menu_SIkG"><ul class="theme-doc-sidebar-menu menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/latest/design/">Introduction to Apache Druid</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="/docs/latest/tutorials/">Getting started</a><button aria-label="Expand sidebar category &#x27;Getting started&#x27;" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/docs/latest/design/architecture">Design</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="/docs/latest/ingestion/">Ingestion</a><button aria-label="Expand sidebar category &#x27;Ingestion&#x27;" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="/docs/latest/data-management/">Data management</a><button aria-label="Expand sidebar category &#x27;Data management&#x27;" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" role="button" aria-expanded="true" href="/docs/latest/querying/sql">Querying</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" tabindex="0" href="/docs/latest/querying/sql">Druid SQL</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/">Native queries</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/query-processing">Query processing</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/query-execution">Query execution</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/dart">Dart engine</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-2 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/troubleshooting">Troubleshooting</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret menu__link--active" role="button" aria-expanded="true" tabindex="0" href="/docs/latest/querying/datasource">Concepts</a></div><ul style="display:block;overflow:visible;height:auto" class="menu__list"><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/datasource">Datasources</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/joins">Joins</a></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-3 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" tabindex="0" href="/docs/latest/querying/lookups">Lookups</a><button aria-label="Expand sidebar category &#x27;Lookups&#x27;" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/multi-value-dimensions">Multi-value dimensions</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/arrays">Arrays</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/nested-columns">Nested columns</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/multitenancy">Multitenancy</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/caching">Query caching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/using-caching">Using query caching</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link" tabindex="0" href="/docs/latest/querying/query-context">Set query context</a></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-3 menu__list-item"><a class="menu__link menu__link--active" aria-current="page" tabindex="0" href="/docs/latest/querying/query-context-reference">Query context reference</a></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" tabindex="0" href="/docs/latest/querying/timeseriesquery">Native query types</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-2 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" tabindex="0" href="/docs/latest/querying/filters">Native query components</a></div></li></ul></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="/docs/latest/api-reference/">API reference</a><button aria-label="Expand sidebar category &#x27;API reference&#x27;" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="/docs/latest/configuration/">Configuration</a><button aria-label="Expand sidebar category &#x27;Configuration&#x27;" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/docs/latest/api-reference/automatic-compaction-api">Operations</a></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist" href="/docs/latest/development/overview">Development</a><button aria-label="Expand sidebar category &#x27;Development&#x27;" aria-expanded="false" type="button" class="clean-btn menu__caret"></button></div></li><li class="theme-doc-sidebar-item-category theme-doc-sidebar-item-category-level-1 menu__list-item menu__list-item--collapsed"><div class="menu__list-item-collapsible"><a class="menu__link menu__link--sublist menu__link--sublist-caret" role="button" aria-expanded="false" href="/docs/latest/release-info/release-notes">Release info</a></div></li><li class="theme-doc-sidebar-item-link theme-doc-sidebar-item-link-level-1 menu__list-item"><a class="menu__link" href="/docs/latest/misc/papers-and-talks">Papers</a></li></ul></nav></div></div></aside><main class="docMainContainer_TBSr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs" itemscope="" itemtype="https://schema.org/BreadcrumbList"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Querying</span><meta itemprop="position" content="1"></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Concepts</span><meta itemprop="position" content="2"></li><li itemscope="" itemprop="itemListElement" itemtype="https://schema.org/ListItem" class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link" itemprop="name">Query context reference</span><meta itemprop="position" content="3"></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Query context reference</h1></header><p>The query context provides runtime configuration for individual queries in Apache Druid. Each parameter in the query context controls a specific aspect of query behavior—from execution timeouts and resource limits to caching policies and processing strategies.</p>
<p>This reference contains context parameters organized by their scope:</p>
<ul>
<li><strong>General parameters</strong>: Applies to all query types.</li>
<li><strong>Parameters by query type</strong>: Applies to a specific type of query, such as TopN.</li>
<li><strong>Vectorization parameters</strong>: Controls vectorized query execution for supported queries.</li>
</ul>
<p>To learn how to set the query context, see <a href="/docs/latest/querying/query-context">Set query context</a>.</p>
<p>For reference on query context parameters specific to Druid SQL, visit <a href="/docs/latest/querying/sql-query-context">SQL query context</a>.
For context parameters related to SQL-based ingestion, see the <a href="/docs/latest/multi-stage-query/reference/#context-parameters">SQL-based ingestion reference</a>.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="general-parameters">General parameters<a href="#general-parameters" class="hash-link" aria-label="Direct link to General parameters" title="Direct link to General parameters"></a></h2>
<p>Unless otherwise noted, the following parameters apply to all query types, and to both native and SQL queries.</p>
<table><thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>timeout</code></td><td><code>druid.server.http.defaultQueryTimeout</code></td><td>Query timeout in millis, beyond which unfinished queries will be cancelled. 0 timeout means <code>no timeout</code> (up to the server-side maximum query timeout, <code>druid.server.http.maxQueryTimeout</code>). To set the default timeout and maximum timeout, see <a href="/docs/latest/configuration/#broker">Broker configuration</a></td></tr><tr><td><code>priority</code></td><td>The default priority is one of the following: <ul><li>Value of <code>priority</code> in the query context, if set</li><li>The value of the runtime property <code>druid.query.default.context.priority</code>, if set and not null</li><li><code>0</code> if the priority is not set in the query context or runtime properties</li></ul></td><td>Query priority. Queries with higher priority get precedence for computational resources.</td></tr><tr><td><code>lane</code></td><td><code>null</code></td><td>Query lane, used to control usage limits on classes of queries. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>queryId</code></td><td>auto-generated</td><td>Unique identifier given to this query. If a query ID is set or known, this can be used to cancel the query</td></tr><tr><td><code>brokerService</code></td><td><code>null</code></td><td>Broker service to which this query should be routed. This parameter is honored only by a broker selector strategy of type <em>manual</em>. See <a href="/docs/latest/design/router#router-strategies">Router strategies</a> for more details.</td></tr><tr><td><code>useCache</code></td><td><code>true</code></td><td>Flag indicating whether to leverage the query cache for this query. When set to false, it disables reading from the query cache for this query. When set to true, Apache Druid uses <code>druid.broker.cache.useCache</code> or <code>druid.historical.cache.useCache</code> to determine whether or not to read from the query cache</td></tr><tr><td><code>populateCache</code></td><td><code>true</code></td><td>Flag indicating whether to save the results of the query to the query cache. Primarily used for debugging. When set to false, it disables saving the results of this query to the query cache. When set to true, Druid uses <code>druid.broker.cache.populateCache</code> or <code>druid.historical.cache.populateCache</code> to determine whether or not to save the results of this query to the query cache</td></tr><tr><td><code>useResultLevelCache</code></td><td><code>true</code></td><td>Flag indicating whether to leverage the result level cache for this query. When set to false, it disables reading from the query cache for this query. When set to true, Druid uses <code>druid.broker.cache.useResultLevelCache</code> to determine whether or not to read from the result-level query cache</td></tr><tr><td><code>populateResultLevelCache</code></td><td><code>true</code></td><td>Flag indicating whether to save the results of the query to the result level cache. Primarily used for debugging. When set to false, it disables saving the results of this query to the query cache. When set to true, Druid uses <code>druid.broker.cache.populateResultLevelCache</code> to determine whether or not to save the results of this query to the result-level query cache</td></tr><tr><td><code>bySegment</code></td><td><code>false</code></td><td>Native queries only. Return &quot;by segment&quot; results. Primarily used for debugging, setting it to <code>true</code> returns results associated with the data segment they came from</td></tr><tr><td><code>finalize</code></td><td><code>N/A</code></td><td>Flag indicating whether to &quot;finalize&quot; aggregation results. Primarily used for debugging. For instance, the <code>hyperUnique</code> aggregator returns the full HyperLogLog sketch instead of the estimated cardinality when this flag is set to <code>false</code></td></tr><tr><td><code>maxScatterGatherBytes</code></td><td><code>druid.server.http.maxScatterGatherBytes</code></td><td>Maximum number of bytes gathered from data processes such as Historicals and realtime processes to execute a query. This parameter can be used to further reduce <code>maxScatterGatherBytes</code> limit at query time. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>maxQueuedBytes</code></td><td><code>druid.broker.http.maxQueuedBytes</code></td><td>Maximum number of bytes queued per query before exerting backpressure on the channel to the data server. Similar to <code>maxScatterGatherBytes</code>, except unlike that configuration, this one will trigger backpressure rather than query failure. Zero means disabled.</td></tr><tr><td><code>maxSubqueryRows</code></td><td><code>druid.server.http.maxSubqueryRows</code></td><td>Upper limit on the number of rows a subquery can generate. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> and [subquery guardrails](../configuration/index.md#Guardrails for materialization of subqueries) for more details.</td></tr><tr><td><code>maxSubqueryBytes</code></td><td><code>druid.server.http.maxSubqueryBytes</code></td><td>Upper limit on the number of bytes a subquery can generate. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> and [subquery guardrails](../configuration/index.md#Guardrails for materialization of subqueries) for more details.</td></tr><tr><td><code>serializeDateTimeAsLong</code></td><td><code>false</code></td><td>If true, DateTime is serialized as long in the result returned by Broker and the data transportation between Broker and compute process</td></tr><tr><td><code>serializeDateTimeAsLongInner</code></td><td><code>false</code></td><td>If true, DateTime is serialized as long in the data transportation between Broker and compute process</td></tr><tr><td><code>enableParallelMerge</code></td><td><code>true</code></td><td>Enable parallel result merging on the Broker. Note that <code>druid.processing.merge.useParallelMergePool</code> must be enabled for this setting to be set to <code>true</code>. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>parallelMergeParallelism</code></td><td><code>druid.processing.merge.parallelism</code></td><td>Maximum number of parallel threads to use for parallel result merging on the Broker. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>parallelMergeInitialYieldRows</code></td><td><code>druid.processing.merge.initialYieldNumRows</code></td><td>Number of rows to yield per ForkJoinPool merge task for parallel result merging on the Broker, before forking off a new task to continue merging sequences. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>parallelMergeSmallBatchRows</code></td><td><code>druid.processing.merge.smallBatchNumRows</code></td><td>Size of result batches to operate on in ForkJoinPool merge tasks for parallel result merging on the Broker. See <a href="/docs/latest/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>useFilterCNF</code></td><td><code>false</code></td><td>If true, Druid will attempt to convert the query filter to Conjunctive Normal Form (CNF). During query processing, columns can be pre-filtered by intersecting the bitmap indexes of all values that match the eligible filters, often greatly reducing the raw number of rows which need to be scanned. But this effect only happens for the top level filter, or individual clauses of a top level &#x27;and&#x27; filter. As such, filters in CNF potentially have a higher chance to utilize a large amount of bitmap indexes on string columns during pre-filtering. However, this setting should be used with great caution, as it can sometimes have a negative effect on performance, and in some cases, the act of computing CNF of a filter can be expensive. We recommend hand tuning your filters to produce an optimal form if possible, or at least verifying through experimentation that using this parameter actually improves your query performance with no ill-effects.</td></tr><tr><td><code>secondaryPartitionPruning</code></td><td><code>true</code></td><td>Enable secondary partition pruning on the Broker. The Broker will always prune unnecessary segments from the input scan based on a filter on time intervals, but if the data is further partitioned with hash or range partitioning, this option will enable additional pruning based on a filter on secondary partition dimensions.</td></tr><tr><td><code>debug</code></td><td><code>false</code></td><td>Flag indicating whether to enable debugging outputs for the query. When set to false, no additional logs will be produced (logs produced will be entirely dependent on your logging level). When set to true, the following addition logs will be produced:<br>- Log the stack trace of the exception (if any) produced by the query</td></tr><tr><td><code>setProcessingThreadNames</code></td><td><code>true</code></td><td>Whether processing thread names will be set to <code>queryType_dataSource_intervals</code> while processing a query. This aids in interpreting thread dumps, and is on by default. Query overhead can be reduced slightly by setting this to <code>false</code>. This has a tiny effect in most scenarios, but can be meaningful in high-QPS, low-per-segment-processing-time scenarios.</td></tr><tr><td><code>sqlPlannerBloat</code></td><td><code>1000</code></td><td>Calcite parameter which controls whether to merge two Project operators when inlining expressions causes complexity to increase. Implemented as a workaround to exception <code>There are not enough rules to produce a node with desired properties: convention=DRUID, sort=[]</code> thrown after rejecting the merge of two projects.</td></tr><tr><td><code>cloneQueryMode</code></td><td><code>excludeClones</code></td><td>Indicates whether clone Historicals should be queried by brokers. Clone servers are created by the <code>cloneServers</code> Coordinator dynamic configuration. Possible values are <code>excludeClones</code>, <code>includeClones</code> and <code>preferClones</code>. <code>excludeClones</code> means that clone Historicals are not queried by the broker. <code>preferClones</code> indicates that when given a choice between the clone Historical and the original Historical which is being cloned, the broker chooses the clones. Historicals which are not involved in the cloning process will still be queried. <code>includeClones</code> means that broker queries any Historical without regarding clone status. This parameter only affects native queries. MSQ does not query Historicals directly.</td></tr></tbody></table>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="parameters-by-query-type">Parameters by query type<a href="#parameters-by-query-type" class="hash-link" aria-label="Direct link to Parameters by query type" title="Direct link to Parameters by query type"></a></h2>
<p>Some query types offer context parameters specific to that query type.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="topn">TopN<a href="#topn" class="hash-link" aria-label="Direct link to TopN" title="Direct link to TopN"></a></h3>
<table><thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>minTopNThreshold</code></td><td><code>1000</code></td><td>The top minTopNThreshold local results from each segment are returned for merging to determine the global topN.</td></tr></tbody></table>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="timeseries">Timeseries<a href="#timeseries" class="hash-link" aria-label="Direct link to Timeseries" title="Direct link to Timeseries"></a></h3>
<table><thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>skipEmptyBuckets</code></td><td><code>false</code></td><td>Disable timeseries zero-filling behavior, so only buckets with results will be returned.</td></tr></tbody></table>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="join-filter">Join filter<a href="#join-filter" class="hash-link" aria-label="Direct link to Join filter" title="Direct link to Join filter"></a></h3>
<table><thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>enableJoinFilterPushDown</code></td><td><code>true</code></td><td>Controls whether a join query will attempt filter push down, which reduces the number of rows that have to be compared in a join operation.</td></tr><tr><td><code>enableJoinFilterRewrite</code></td><td><code>true</code></td><td>Controls whether filter clauses that reference non-base table columns will be rewritten into filters on base table columns.</td></tr><tr><td><code>enableJoinFilterRewriteValueColumnFilters</code></td><td><code>false</code></td><td>Controls whether Druid rewrites non-base table filters on non-key columns in the non-base table. Requires a scan of the non-base table.</td></tr><tr><td><code>enableRewriteJoinToFilter</code></td><td><code>true</code></td><td>Controls whether a join can be pushed partial or fully to the base table as a filter at runtime.</td></tr><tr><td><code>joinFilterRewriteMaxSize</code></td><td><code>10000</code></td><td>The maximum size of the correlated value set used for filter rewrites. Set this limit to prevent excessive memory use.</td></tr></tbody></table>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="groupby">GroupBy<a href="#groupby" class="hash-link" aria-label="Direct link to GroupBy" title="Direct link to GroupBy"></a></h3>
<p>See the list of <a href="/docs/latest/querying/groupbyquery#advanced-configurations">GroupBy query context</a> parameters available on the groupBy
query page.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="vectorization-parameters">Vectorization parameters<a href="#vectorization-parameters" class="hash-link" aria-label="Direct link to Vectorization parameters" title="Direct link to Vectorization parameters"></a></h2>
<p>The GroupBy and Timeseries query types can run in <em>vectorized</em> mode, which speeds up query execution by processing
batches of rows at a time. Not all queries can be vectorized. In particular, vectorization currently has the following
requirements:</p>
<ul>
<li>All query-level filters must either be able to run on bitmap indexes or must offer vectorized row-matchers. These
include <code>selector</code>, <code>bound</code>, <code>in</code>, <code>like</code>, <code>regex</code>, <code>search</code>, <code>and</code>, <code>or</code>, and <code>not</code>.</li>
<li>All filters in filtered aggregators must offer vectorized row-matchers.</li>
<li>All aggregators must offer vectorized implementations. These include <code>count</code>, <code>doubleSum</code>, <code>floatSum</code>, <code>longSum</code>. <code>longMin</code>,
<code>longMax</code>, <code>doubleMin</code>, <code>doubleMax</code>, <code>floatMin</code>, <code>floatMax</code>, <code>longAny</code>, <code>doubleAny</code>, <code>floatAny</code>, <code>stringAny</code>,
<code>hyperUnique</code>, <code>filtered</code>, <code>approxHistogram</code>, <code>approxHistogramFold</code>, and <code>fixedBucketsHistogram</code> (with numerical input).</li>
<li>All virtual columns must offer vectorized implementations. Currently for expression virtual columns, support for vectorization is decided on a per expression basis, depending on the type of input and the functions used by the expression. See the currently supported list in the <a href="/docs/latest/querying/math-expr#vectorization-support">expression documentation</a>.</li>
<li>For GroupBy: All dimension specs must be &quot;default&quot; (no extraction functions or filtered dimension specs).</li>
<li>For GroupBy: No multi-value dimensions.</li>
<li>For Timeseries: No &quot;descending&quot; order.</li>
<li>Only immutable segments (not real-time).</li>
<li>Only <a href="/docs/latest/querying/datasource#table">table datasources</a> (not joins, subqueries, lookups, or inline datasources).</li>
</ul>
<p>Other query types (like TopN, Scan, Select, and Search) ignore the <code>vectorize</code> parameter, and will execute without
vectorization. These query types will ignore the <code>vectorize</code> parameter even if it is set to <code>&quot;force&quot;</code>.</p>
<table><thead><tr><th>Parameter</th><th>Default</th><th>Description</th></tr></thead><tbody><tr><td><code>vectorize</code></td><td><code>true</code></td><td>Enables or disables vectorized query execution. Possible values are <code>false</code> (disabled), <code>true</code> (enabled if possible, disabled otherwise, on a per-segment basis), and <code>force</code> (enabled, and groupBy or timeseries queries that cannot be vectorized will fail). The <code>&quot;force&quot;</code> setting is meant to aid in testing, and is not generally useful in production (since real-time segments can never be processed with vectorized execution, any queries on real-time data will fail). This will override <code>druid.query.default.context.vectorize</code> if it&#x27;s set.</td></tr><tr><td><code>vectorSize</code></td><td><code>512</code></td><td>Sets the row batching size for a particular query. This will override <code>druid.query.default.context.vectorSize</code> if it&#x27;s set.</td></tr><tr><td><code>vectorizeVirtualColumns</code></td><td><code>true</code></td><td>Enables or disables vectorized query processing of queries with virtual columns, layered on top of <code>vectorize</code> (<code>vectorize</code> must also be set to true for a query to utilize vectorization). Possible values are <code>false</code> (disabled), <code>true</code> (enabled if possible, disabled otherwise, on a per-segment basis), and <code>force</code> (enabled, and groupBy or timeseries queries with virtual columns that cannot be vectorized will fail). The <code>&quot;force&quot;</code> setting is meant to aid in testing, and is not generally useful in production. This will override <code>druid.query.default.context.vectorizeVirtualColumns</code> if it&#x27;s set.</td></tr></tbody></table>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="learn-more">Learn more<a href="#learn-more" class="hash-link" aria-label="Direct link to Learn more" title="Direct link to Learn more"></a></h2>
<p>For more information, see the following topics:</p>
<ul>
<li><a href="/docs/latest/querying/query-context">Set query context</a> to learn how to configure query context parameters.</li>
<li><a href="/docs/latest/querying/sql-query-context">SQL query context</a> for query context parameters specific to Druid SQL.</li>
<li><a href="/docs/latest/multi-stage-query/reference/#context-parameters">SQL-based ingestion reference</a> for context parameters used in SQL-based ingestion (MSQ).</li>
</ul></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/latest/querying/query-context"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Set query context</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/latest/querying/timeseriesquery"><div class="pagination-nav__sublabel">Next</div><div class="pagination-nav__label">Timeseries</div></a></nav></div></div><div class="col col--3"><div class="tableOfContents_bqdL thin-scrollbar theme-doc-toc-desktop"><ul class="table-of-contents table-of-contents__left-border"><li><a href="#general-parameters" class="table-of-contents__link toc-highlight">General parameters</a></li><li><a href="#parameters-by-query-type" class="table-of-contents__link toc-highlight">Parameters by query type</a><ul><li><a href="#topn" class="table-of-contents__link toc-highlight">TopN</a></li><li><a href="#timeseries" class="table-of-contents__link toc-highlight">Timeseries</a></li><li><a href="#join-filter" class="table-of-contents__link toc-highlight">Join filter</a></li><li><a href="#groupby" class="table-of-contents__link toc-highlight">GroupBy</a></li></ul></li><li><a href="#vectorization-parameters" class="table-of-contents__link toc-highlight">Vectorization parameters</a></li><li><a href="#learn-more" class="table-of-contents__link toc-highlight">Learn more</a></li></ul></div></div></div></div></main></div></div></div><footer class="footer"><div class="container container-fluid"><div class="footer__bottom text--center"><div class="margin-bottom--sm"><img src="/img/favicon.png" class="footer__logo themedComponent_mlkZ themedComponent--light_NVdE"><img src="/img/favicon.png" class="footer__logo themedComponent_mlkZ themedComponent--dark_xIcU"></div><div class="footer__copyright">Copyright © 2025 Apache Software Foundation. Except where otherwise noted, licensed under CC BY-SA 4.0. Apache Druid, Druid, and the Druid logo are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries.</div></div></div></footer></div>
</body>
</html>