blob: 72244bf8a9e8c1ad5c97f82ebd12a49281e29d43 [file] [log] [blame]
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[9772],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>h});var n=r(67294);function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},p="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=c(r),m=i,h=p["".concat(l,".").concat(m)]||p[m]||d[m]||a;return r?n.createElement(h,o(o({ref:t},u),{},{components:r})):n.createElement(h,o({ref:t},u))}));function h(e,t){var r=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s[p]="string"==typeof e?e:i,o[1]=s;for(var c=2;c<a;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}m.displayName="MDXCreateElement"},85765:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>u,contentTitle:()=>l,default:()=>h,frontMatter:()=>s,metadata:()=>c,toc:()=>p});var n=r(87462),i=r(63366),a=(r(67294),r(3905)),o=["components"],s={id:"query-processing",title:"Query processing"},l=void 0,c={unversionedId:"querying/query-processing",id:"querying/query-processing",title:"Query processing",description:"\x3c!--",source:"@site/docs/latest/querying/query-processing.md",sourceDirName:"querying",slug:"/querying/query-processing",permalink:"/docs/latest/querying/query-processing",draft:!1,tags:[],version:"current",frontMatter:{id:"query-processing",title:"Query processing"},sidebar:"docs",previous:{title:"Native queries",permalink:"/docs/latest/querying/"},next:{title:"Query execution",permalink:"/docs/latest/querying/query-execution"}},u={},p=[{value:"Learn more",id:"learn-more",level:2}],d={toc:p},m="wrapper";function h(e){var t=e.components,r=(0,i.Z)(e,o);return(0,a.kt)(m,(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"This topic provides a high-level overview of how Apache Druid distributes and processes queries."),(0,a.kt)("p",null,"The general flow is as follows:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"A query enters the ",(0,a.kt)("a",{parentName:"li",href:"/docs/latest/design/broker"},"Broker")," service, which identifies the segments with data that may pertain to that query. The list of segments is always pruned by time, and may also be pruned by other attributes depending on how the datasource is partitioned."),(0,a.kt)("li",{parentName:"ol"},"The Broker identifies which ",(0,a.kt)("a",{parentName:"li",href:"/docs/latest/design/historical"},"Historical")," and ",(0,a.kt)("a",{parentName:"li",href:"/docs/latest/design/middlemanager"},"MiddleManager")," services are serving those segments and distributes a rewritten subquery to each of the services."),(0,a.kt)("li",{parentName:"ol"},"The Historical and MiddleManager services execute each subquery and return results to the Broker."),(0,a.kt)("li",{parentName:"ol"},"The Broker merges the partial results to get the final answer, which it returns to the original caller.")),(0,a.kt)("p",null,"Druid uses time and attribute pruning to minimize the data it must scan for each query."),(0,a.kt)("p",null,"For filters that are more precise than what the Broker uses for pruning, the ",(0,a.kt)("a",{parentName:"p",href:"/docs/latest/design/storage#indexing-and-handoff"},"indexing structures")," inside each segment allow Historical services to identify matching rows before accessing the data. Once the Historical service knows which rows match a particular query, it only accesses the requires rows and columns."),(0,a.kt)("p",null,"To maximize query performance, Druid uses the following techniques:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Pruning the set of segments accessed for a query."),(0,a.kt)("li",{parentName:"ul"},"Within each segment, using indexes to identify which rows must be accessed."),(0,a.kt)("li",{parentName:"ul"},"Within each segment, only reading the specific rows and columns that are relevant to a particular query.")),(0,a.kt)("h2",{id:"learn-more"},"Learn more"),(0,a.kt)("p",null,"See the following topic for more information:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/docs/latest/querying/query-execution"},"Query execution")," to learn how Druid services process query statements.")))}h.isMDXComponent=!0}}]);