blob: dd6b0e241da2f8bbde2f935e57e3239be6cafa7b [file] [log] [blame]
<!doctype html>
<html lang="en" dir="ltr" class="docs-wrapper docs-doc-page docs-version-current plugin-docs plugin-id-default docs-doc-id-querying/query-context">
<head>
<meta charset="UTF-8">
<meta name="generator" content="Docusaurus v2.4.1">
<title data-rh="true">Query context | 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/26.0.0/querying/query-context"><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 | 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/26.0.0/querying/query-context"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/26.0.0/querying/query-context" hreflang="en"><link data-rh="true" rel="alternate" href="https://druid.apache.org/docs/26.0.0/querying/query-context" hreflang="x-default"><link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-131010415-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-131010415-1",{})</script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script><link rel="stylesheet" href="/assets/css/styles.f80751b3.css">
<link rel="preload" href="/assets/js/runtime~main.38900cbf.js" as="script">
<link rel="preload" href="/assets/js/main.5e106d68.js" as="script">
</head>
<body class="navigation-with-keyboard">
<script>!function(){function t(t){document.documentElement.setAttribute("data-theme",t)}var e=function(){var t=null;try{t=new URLSearchParams(window.location.search).get("docusaurus-theme")}catch(t){}return t}()||function(){var t=null;try{t=localStorage.getItem("theme")}catch(t){}return t}();t(null!==e?e:"light")}()</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="themedImage_ToTc themedImage--light_HNdA"><img src="/img/druid_nav.png" alt="Apache® Druid" class="themedImage_ToTc themedImage--dark_i4oU"></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/26.0.0/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="searchBox_ZlJk"><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon" tabindex="0"></span><input type="search" id="search_input_react" 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 docsWrapper_BCFX"><button aria-label="Scroll back to top" class="clean-btn theme-back-to-top-button backToTopButton_sjWU" type="button"></button><div class="docPage__5DB"><aside class="theme-doc-sidebar-container docSidebarContainer_b6E3"><div class="sidebarViewport_Xe31"><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-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" aria-expanded="false" href="/docs/26.0.0/design/">Getting started</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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/tutorials/tutorial-batch">Tutorials</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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/ingestion/">Ingestion</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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/data-management/">Data management</a></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" aria-expanded="true" href="/docs/26.0.0/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" aria-expanded="false" tabindex="0" href="/docs/26.0.0/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/26.0.0/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/26.0.0/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/26.0.0/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" aria-expanded="true" tabindex="0" href="/docs/26.0.0/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/26.0.0/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/26.0.0/querying/joins">Joins</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/26.0.0/querying/lookups">Lookups</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/26.0.0/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/26.0.0/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/26.0.0/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/26.0.0/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/26.0.0/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 menu__link--active" aria-current="page" tabindex="0" href="/docs/26.0.0/querying/query-context">Query context</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" aria-expanded="false" tabindex="0" href="/docs/26.0.0/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" aria-expanded="false" tabindex="0" href="/docs/26.0.0/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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/configuration/">Configuration</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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/operations/web-console">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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/development/overview">Development</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 menu__link--sublist-caret" aria-expanded="false" href="/docs/26.0.0/misc/papers-and-talks">Misc</a></div></li></ul></nav></div></div></aside><main class="docMainContainer_gTbr"><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</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</h1></header><p>The query context is used for various query configuration parameters. Query context parameters can be specified in
the following ways:</p><ul><li>For <a href="/docs/26.0.0/querying/sql-api">Druid SQL</a>, context parameters are provided either in a JSON object named <code>context</code> to the
HTTP POST API, or as properties to the JDBC connection.</li><li>For <a href="/docs/26.0.0/querying/">native queries</a>, context parameters are provided in a JSON object named <code>context</code>.</li></ul><p>Note that setting query context will override both the default value and the runtime properties value in the format of
<code>druid.query.default.context.{property_key}</code> (if set). </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.</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/26.0.0/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/26.0.0/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/26.0.0/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/26.0.0/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>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/26.0.0/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>parallelMergeParallelism</code></td><td><code>druid.processing.merge.pool.parallelism</code></td><td>Maximum number of parallel threads to use for parallel result merging on the Broker. See <a href="/docs/26.0.0/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>parallelMergeInitialYieldRows</code></td><td><code>druid.processing.merge.task.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/26.0.0/configuration/#broker">Broker configuration</a> for more details.</td></tr><tr><td><code>parallelMergeSmallBatchRows</code></td><td><code>druid.processing.merge.task.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/26.0.0/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>enableJoinLeftTableScanDirect</code></td><td><code>false</code></td><td>This flag applies to queries which have joins. For joins, where left child is a simple scan with a filter, by default, druid will run the scan as a query and the join the results to the right child on broker. Setting this flag to true overrides that behavior and druid will attempt to push the join to data servers instead. Please note that the flag could be applicable to queries even if there is no explicit join. since queries can internally translated into a join by the SQL planner.</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>maxNumericInFilters</code></td><td><code>-1</code></td><td>Max limit for the amount of numeric values that can be compared for a string type dimension when the entire SQL WHERE clause of a query translates only to an <a href="/docs/26.0.0/querying/filters#or">OR</a> of <a href="/docs/26.0.0/querying/filters#bound-filter">Bound filter</a>. By default, Druid does not restrict the amount of of numeric Bound Filters on String columns, although this situation may block other queries from running. Set this parameter to a smaller value to prevent Druid from running queries that have prohibitively long segment processing times. The optimal limit requires some trial and error; we recommend starting with 100. Users who submit a query that exceeds the limit of <code>maxNumericInFilters</code> should instead rewrite their queries to use strings in the <code>WHERE</code> clause instead of numbers. For example, <code>WHERE someString IN (‘123’, ‘456’)</code>. This value cannot exceed the set system configuration <code>druid.sql.planner.maxNumericInFilters</code>. This value is ignored if <code>druid.sql.planner.maxNumericInFilters</code> is not set explicitly.</td></tr><tr><td><code>inSubQueryThreshold</code></td><td><code>2147483647</code></td><td>Threshold for minimum number of values in an IN clause to convert the query to a JOIN operation on an inlined table rather than a predicate. A threshold of 0 forces usage of an inline table in all cases; a threshold of <!-- -->[Integer.MAX_VALUE]<!-- --> forces usage of OR in all cases.</td></tr></tbody></table><h2 class="anchor anchorWithStickyNavbar_LWe7" id="druid-sql-parameters">Druid SQL parameters<a href="#druid-sql-parameters" class="hash-link" aria-label="Direct link to Druid SQL parameters" title="Direct link to Druid SQL parameters"></a></h2><p>See <a href="/docs/26.0.0/querying/sql-query-context">SQL query context</a> for query context parameters specific to Druid SQL queries.</p><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/26.0.0/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 &quot;selector&quot;, &quot;bound&quot;, &quot;in&quot;, &quot;like&quot;, &quot;regex&quot;, &quot;search&quot;, &quot;and&quot;, &quot;or&quot;, and &quot;not&quot;.</li><li>All filters in filtered aggregators must offer vectorized row-matchers.</li><li>All aggregators must offer vectorized implementations. These include &quot;count&quot;, &quot;doubleSum&quot;, &quot;floatSum&quot;, &quot;longSum&quot;, &quot;longMin&quot;,
&quot;longMax&quot;, &quot;doubleMin&quot;, &quot;doubleMax&quot;, &quot;floatMin&quot;, &quot;floatMax&quot;, &quot;longAny&quot;, &quot;doubleAny&quot;, &quot;floatAny&quot;, &quot;stringAny&quot;,
&quot;hyperUnique&quot;, &quot;filtered&quot;, &quot;approxHistogram&quot;, &quot;approxHistogramFold&quot;, and &quot;fixedBucketsHistogram&quot; (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/26.0.0/misc/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/26.0.0/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></div></article><nav class="pagination-nav docusaurus-mt-lg" aria-label="Docs pages"><a class="pagination-nav__link pagination-nav__link--prev" href="/docs/26.0.0/querying/using-caching"><div class="pagination-nav__sublabel">Previous</div><div class="pagination-nav__label">Using query caching</div></a><a class="pagination-nav__link pagination-nav__link--next" href="/docs/26.0.0/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="#druid-sql-parameters" class="table-of-contents__link toc-highlight">Druid SQL 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></ul></div></div></div></div></main></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="themedImage_ToTc themedImage--light_HNdA footer__logo"><img src="/img/favicon.png" class="themedImage_ToTc themedImage--dark_i4oU footer__logo"></div><div class="footer__copyright">Copyright © 2023 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>
<script src="/assets/js/runtime~main.38900cbf.js"></script>
<script src="/assets/js/main.5e106d68.js"></script>
</body>
</html>