Trace a Cube API request through to the queries it runs on your data source.
Cube can tag the queries it sends to your data source with a trace_id SQL
comment, letting you match a query in your data source’s query history back to
the API request that caused it.This is useful when one API request fans out into several data source
queries — every one of them carries the same trace_id.
trace_id identifies the API request and matches the field of the same name in
the Query History export.
A unique comment per request makes each query textually distinct, which
prevents your data source from reusing cached results — Snowflake’s persisted
query results and BigQuery’s result cache both require identical query text.
Expect more queries to actually execute, and on Snowflake a warehouse that
would have stayed suspended may resume.
Clients calling the REST (JSON) API can
supply their own identifier through the x-request-id or traceparent request
header, letting you trace a query back to a request in your own application.
Otherwise Cube generates one.
Queries issued to serve an API request are tagged. Pre-aggregation builds,
export bucket operations, refresh keys, background refreshes, and Cube’s own
internal queries are left untagged, since there is no API request to trace them
back to.A single request usually produces one tagged query, but not always — a query
reading a lambda pre-aggregation’s source table, for instance, is tagged too.
Match on trace_id rather than assuming one row per request.Not every request produces a tagged query to find: one served from the cache or
from a pre-aggregation never reaches your data source, and when identical
queries arrive together Cube runs them once, under whichever request got there
first. The other requests still appear in the Query History export, but their
trace_id matches nothing in your data source’s query history.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Cube Documentation","colors":{"primary":"#5339CF","light":"#A5A3FF","dark":"#716EEE"},"logo":{"light":"https://mintcdn.com/cubed3/wCTntgEXVYYYnx4l/logo/light.svg?fit=max\u0026auto=format\u0026n=wCTntgEXVYYYnx4l\u0026q=85\u0026s=8bbf45ba64eac6116629064fac55aad7","dark":"https://mintcdn.com/cubed3/wCTntgEXVYYYnx4l/logo/dark.svg?fit=max\u0026auto=format\u0026n=wCTntgEXVYYYnx4l\u0026q=85\u0026s=d8fa230950c8c63b3c2f88d2768694d0"},"favicon":"https://mintcdn.com/cubed3/wCTntgEXVYYYnx4l/favicon.svg?fit=max\u0026auto=format\u0026n=wCTntgEXVYYYnx4l\u0026q=85\u0026s=3b0cb7aa770d2abd546ef19463fbba8c","navbar":{"links":[{"href":"https://cube.dev/demos","label":"Demos"},{"href":"https://cube.dev/changelog","label":"Changelog"},{"href":"https://slack.cube.dev","label":"Community"}],"primary":{"type":"button","label":"Get Started","href":"https://cubecloud.dev/auth/signup"}},"footer":{"socials":{"x":"https://x.com/the_cube_dev","github":"https://github.com/cube-js/cube","linkedin":"https://www.linkedin.com/company/cube-dev"}},"seo":{"metatags":{"og:type":"website","og:site_name":"Cube Documentation"},"indexing":"navigable"},"icons":{"library":"tabler"},"styling":{"codeblocks":"dark","latex":false},"integrations":{"gtm":{"tagId":"GTM-52W7VM2"}},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cubed3","hasAudioNarration":false,"actualSubdomain":"cubed3","customDomains":["docs.cube.dev"],"gitSource":{"type":"github","owner":"cube-js","repo":"cube","deployBranch":"master","contentDirectory":"docs-mintlify","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae36c39347baa1c1c492169","collectionId":"70ba4f16-eb6d-4001-b466-24ec58cc9a50","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae36c39347baa1c1c492169"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae36cc106ea204881aab6c8","clientVersion":"0.0.4006","searchFilterCounts":[{"language":"default","tag":"API","count":232},{"language":"default","tag":"Platform Endpoints","count":225},{"language":"default","tag":"Documentation","count":101},{"language":"default","tag":"Admin","count":94},{"language":"default","tag":"Data Modeling","count":65},{"language":"default","tag":"Recipes","count":47},{"language":"default","tag":"Topics","count":47},{"language":"default","tag":"Reference","count":44},{"language":"default","tag":"Connect to data","count":31},{"language":"default","tag":"Explore \u0026 Analyze","count":30}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"pause-universal-search-reconcile","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"per-site-search-delta","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-private-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"#content-area table,.mdx-content table{width:100%!important}"}],"page":{"pagePath":"admin/connect-to-data/query-tracing","slug":"/admin/connect-to-data/query-tracing","pageMetadata":{"title":"Query tracing","description":"Trace a Cube API request through to the queries it runs on your data source.","href":"/admin/connect-to-data/query-tracing"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Trace a Cube API request through to the queries it runs on your data source.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Cube can tag the queries it sends to your data source with a `,_jsx(_components.code,{children:`trace_id`}),` SQL\ncomment, letting you match a query in your data source’s query history back to\nthe API request that caused it.`]}),`\n`,_jsxs(_components.p,{children:[`This is useful when one API request fans out into several data source\nqueries — every one of them carries the same `,_jsx(_components.code,{children:`trace_id`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`configuration`,children:`Configuration`}),`\n`,_jsxs(_components.p,{children:[`Set `,_jsx(_components.a,{href:`/reference/configuration/environment-variables#cubejs_sql_include_trace_id`,children:_jsx(_components.code,{children:`CUBEJS_SQL_INCLUDE_TRACE_ID`})}),`\nto `,_jsx(_components.code,{children:`true`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`dotenv`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`dotenv`,children:_jsxs(_components.code,{language:`dotenv`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#9CDCFE`,\"--shiki-dark\":`#9CDCFE`},children:`CUBEJS_SQL_INCLUDE_TRACE_ID`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:`=true`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Queries then reach your data source with the comment appended:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`sql`,children:_jsx(_components.pre,{className:`shiki shiki-themes dark-plus dark-plus`,style:{backgroundColor:`#0B0C0E`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},language:`sql`,children:_jsxs(_components.code,{language:`sql`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#569CD6`,\"--shiki-dark\":`#569CD6`},children:`SELECT`}),_jsx(_components.span,{style:{color:`#D4D4D4`,\"--shiki-dark\":`#D4D4D4`},children:` ...`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A9955`,\"--shiki-dark\":`#6A9955`},children:`/* trace_id: f47ac10b-58cc-4372-a567-0e02b2c3d479 */`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`trace_id`}),` identifies the API request and matches the field of the same name in\nthe `,_jsx(_components.a,{href:`/admin/monitoring/monitoring-integrations#query-history-export`,children:`Query History export`}),`.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`A unique comment per request makes each query textually distinct, which\nprevents your data source from reusing cached results — Snowflake’s persisted\nquery results and BigQuery’s result cache both require identical query text.\nExpect more queries to actually execute, and on Snowflake a warehouse that\nwould have stayed suspended may resume.`})}),`\n`,_jsx(Heading,{level:`2`,id:`finding-the-comment-in-your-data-source`,children:`Finding the comment in your data source`}),`\n`,_jsxs(_components.p,{children:[`Some query history views truncate long SQL, and a few omit comments entirely.\nIf you can’t find the `,_jsx(_components.code,{children:`trace_id`}),`, check where you’re reading it from:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Snowflake`}),`: `,_jsx(_components.code,{children:`QUERY_HISTORY`}),`. Note that Snowflake strips `,_jsx(_components.em,{children:`leading`}),` comments,\nwhich is why Cube appends.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Redshift`}),`: `,_jsx(_components.code,{children:`SYS_QUERY_TEXT`}),`, reassembled with `,_jsx(_components.code,{children:`LISTAGG`}),`.\n`,_jsx(_components.code,{children:`SYS_QUERY_HISTORY`}),` and `,_jsx(_components.code,{children:`STL_QUERY`}),` truncate at 4000 characters.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`BigQuery`}),`: `,_jsx(_components.code,{children:`INFORMATION_SCHEMA.JOBS`}),`. Cloud Audit Logs truncate at 50K\ncharacters.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Databricks`}),`: `,_jsx(_components.code,{children:`system.query.history`}),`. Empty when customer-managed keys are\nenabled.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Postgres`}),`: server logs (`,_jsx(_components.code,{children:`log_statement`}),`). `,_jsx(_components.code,{children:`pg_stat_activity.query`}),`\ntruncates at `,_jsx(_components.code,{children:`track_activity_query_size`}),` (1024 bytes by default).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`MySQL`}),`: the general or slow query log.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`supplying-your-own-identifier`,children:`Supplying your own identifier`}),`\n`,_jsxs(_components.p,{children:[`Clients calling the `,_jsx(_components.a,{href:`/reference/core-data-apis/rest-api`,children:`REST (JSON) API`}),` can\nsupply their own identifier through the `,_jsx(_components.code,{children:`x-request-id`}),` or `,_jsx(_components.code,{children:`traceparent`}),` request\nheader, letting you trace a query back to a request in your own application.\nOtherwise Cube generates one.`]}),`\n`,_jsx(Heading,{level:`2`,id:`scope`,children:`Scope`}),`\n`,_jsx(_components.p,{children:`Queries issued to serve an API request are tagged. Pre-aggregation builds,\nexport bucket operations, refresh keys, background refreshes, and Cube’s own\ninternal queries are left untagged, since there is no API request to trace them\nback to.`}),`\n`,_jsxs(_components.p,{children:[`A single request usually produces one tagged query, but not always — a query\nreading a lambda pre-aggregation’s source table, for instance, is tagged too.\nMatch on `,_jsx(_components.code,{children:`trace_id`}),` rather than assuming one row per request.`]}),`\n`,_jsxs(_components.p,{children:[`Not every request produces a tagged query to find: one served from the cache or\nfrom a pre-aggregation never reaches your data source, and when identical\nqueries arrive together Cube runs them once, under whichever request got there\nfirst. The other requests still appear in the Query History export, but their\n`,_jsx(_components.code,{children:`trace_id`}),` matches nothing in your data source’s query history.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":"dark","config":{},"pageMetadata":{"title":"Query tracing","description":"Trace a Cube API request through to the queries it runs on your data source.","href":"/admin/connect-to-data/query-tracing"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Configuration","slug":"configuration","depth":2,"children":[]},{"title":"Finding the comment in your data source","slug":"finding-the-comment-in-your-data-source","depth":2,"children":[]},{"title":"Supplying your own identifier","slug":"supplying-your-own-identifier","depth":2,"children":[]},{"title":"Scope","slug":"scope","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/cubed3/664218bb78b6ac43/cube-tracking.js","/_mintlify/custom/cubed3/73c42f6b43b9b3b0/scripts/extract-chat.js","/_mintlify/custom/cubed3/8cdb0d4163a42096/scripts/extract-core-data.js","/_mintlify/custom/cubed3/2a4cd4489f51af38/clay.js"],"subdomain":"cubed3","siteName":"Cube Documentation","title":"Query tracing - Cube Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-29T14:42:47.588Z","originalFileLocation":"admin/connect-to-data/query-tracing.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Trace a Cube API request through to the queries it runs on your data source.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Cube Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Query tracing - Cube Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Trace a Cube API request through to the queries it runs on your data source.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Cube Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.cube.dev/admin/connect-to-data/query-tracing\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cubed3.mintlify.app/_mintlify/api/og/v2?division=Connect+to+data\u0026amp;title=Query+tracing\u0026amp;description=Trace+a+Cube+API+request+through+to+the+queries+it+runs+on+your+data+source.\u0026amp;theme=784e8a91f0fc65e42d72e853\u0026amp;signature=2a6a04a775dd710b45511b35558693f6dcc51845c324d4c62ba4fb47886f4614\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Query tracing - Cube Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Trace a Cube API request through to the queries it runs on your data source.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cubed3.mintlify.app/_mintlify/api/og/v2?division=Connect+to+data\u0026amp;title=Query+tracing\u0026amp;description=Trace+a+Cube+API+request+through+to+the+queries+it+runs+on+your+data+source.\u0026amp;theme=784e8a91f0fc65e42d72e853\u0026amp;signature=2a6a04a775dd710b45511b35558693f6dcc51845c324d4c62ba4fb47886f4614\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/cubed3/JtLYPWhDFrYGSK8W/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Cube Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5339CF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.cube.dev/admin/connect-to-data/query-tracing\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/admin/connect-to-data/query-tracing.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.cube.dev/#organization\",\"name\":\"Cube Documentation\",\"url\":\"https://docs.cube.dev\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/cubed3/wCTntgEXVYYYnx4l/logo/light.svg?fit=max\u0026auto=format\u0026n=wCTntgEXVYYYnx4l\u0026q=85\u0026s=8bbf45ba64eac6116629064fac55aad7\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.cube.dev#website\",\"name\":\"Cube Documentation\",\"url\":\"https://docs.cube.dev\",\"publisher\":{\"@id\":\"https://docs.cube.dev/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing#webpage\",\"url\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing\",\"name\":\"Query tracing\",\"description\":\"Trace a Cube API request through to the queries it runs on your data source.\",\"dateModified\":\"2026-10-29T14:42:47.588Z\",\"isPartOf\":{\"@id\":\"https://docs.cube.dev#website\"},\"breadcrumb\":{\"@id\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Connect to data\",\"item\":\"https://docs.cube.dev/admin/connect-to-data/index\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Query tracing\",\"item\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing#article\",\"headline\":\"Query tracing\",\"name\":\"Query tracing\",\"description\":\"Trace a Cube API request through to the queries it runs on your data source.\",\"url\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing\",\"mainEntityOfPage\":{\"@id\":\"https://docs.cube.dev/admin/connect-to-data/query-tracing#webpage\"},\"dateModified\":\"2026-10-29T14:42:47.588Z\",\"publisher\":{\"@id\":\"https://docs.cube.dev/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.cube.dev#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Cube Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Cube Documentation","nav":{"global":null,"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":"/docs/introduction"}]},{"tab":"Admin","groups":[{"group":"Connect to data","pages":[{"title":"Connect to data","sidebarTitle":"Overview","mode":"wide","href":"/admin/connect-to-data"},{"group":"Data Sources","root":{"title":"Data Sources","sidebarTitle":"Overview","mode":"wide","href":"/admin/connect-to-data/data-sources/index"},"pages":[{"title":"Amazon Athena","href":"/admin/connect-to-data/data-sources/aws-athena"},{"title":"AWS Redshift","href":"/admin/connect-to-data/data-sources/aws-redshift"},{"title":"ClickHouse","href":"/admin/connect-to-data/data-sources/clickhouse"},{"title":"Databricks","href":"/admin/connect-to-data/data-sources/databricks-jdbc"},{"title":"Druid","href":"/admin/connect-to-data/data-sources/druid"},{"title":"DuckDB","href":"/admin/connect-to-data/data-sources/duckdb"},{"title":"Firebolt","href":"/admin/connect-to-data/data-sources/firebolt"},{"title":"Google BigQuery","href":"/admin/connect-to-data/data-sources/google-bigquery"},{"title":"Hive / SparkSQL","href":"/admin/connect-to-data/data-sources/hive"},{"title":"ksqlDB","href":"/admin/connect-to-data/data-sources/ksqldb"},{"title":"Materialize","href":"/admin/connect-to-data/data-sources/materialize"},{"title":"MongoDB","href":"/admin/connect-to-data/data-sources/mongodb"},{"title":"Microsoft Fabric","href":"/admin/connect-to-data/data-sources/ms-fabric"},{"title":"Microsoft SQL Server","href":"/admin/connect-to-data/data-sources/ms-sql"},{"title":"MySQL","href":"/admin/connect-to-data/data-sources/mysql"},{"title":"Oracle","href":"/admin/connect-to-data/data-sources/oracle"},{"title":"Apache Pinot","href":"/admin/connect-to-data/data-sources/pinot"},{"title":"Postgres","href":"/admin/connect-to-data/data-sources/postgres"},{"title":"Presto","href":"/admin/connect-to-data/data-sources/presto"},{"title":"QuestDB","href":"/admin/connect-to-data/data-sources/questdb"},{"title":"RisingWave","href":"/admin/connect-to-data/data-sources/risingwave"},{"title":"SingleStore","href":"/admin/connect-to-data/data-sources/singlestore"},{"title":"Snowflake","href":"/admin/connect-to-data/data-sources/snowflake"},{"title":"SQLite","href":"/admin/connect-to-data/data-sources/sqlite"},{"title":"Trino","href":"/admin/connect-to-data/data-sources/trino"},{"title":"Vertica","href":"/admin/connect-to-data/data-sources/vertica"}]},{"title":"Connecting to multiple data sources","href":"/admin/connect-to-data/multiple-data-sources"},{"title":"Querying concurrency","description":"All queries to data APIs are processed asynchronously via a query queue. It allows to optimize the load and increase querying performance.","href":"/admin/connect-to-data/concurrency"},{"title":"Query tracing","href":"/admin/connect-to-data/query-tracing"},{"title":"Set up per-user OAuth","description":"Configure Cube to authenticate each user with their own OAuth token, falling back to a service account when a user has no active token.","href":"/admin/connect-to-data/oauth-authentication"}]},{"group":"Users \u0026 Permissions","pages":[{"title":"Manage users","href":"/admin/users-and-permissions/manage-users"},{"title":"Roles \u0026 Permissions","href":"/admin/users-and-permissions/roles-and-permissions"},{"title":"User Attributes","href":"/admin/users-and-permissions/user-attributes"},{"title":"User groups","href":"/admin/users-and-permissions/user-groups"},{"title":"Custom roles","href":"/admin/users-and-permissions/custom-roles"}]},{"group":"SSO \u0026 Identity Providers","pages":[{"title":"Overview","sidebarTitle":"Overview","href":"/admin/sso/index"},{"title":"Google Workspace","href":"/admin/sso/google-workspace"},{"group":"Microsoft Entra ID","pages":[{"title":"SAML authentication with Microsoft Entra ID","sidebarTitle":"SAML","href":"/admin/sso/microsoft-entra-id/saml"},{"title":"SCIM provisioning with Microsoft Entra ID","sidebarTitle":"SCIM","href":"/admin/sso/microsoft-entra-id/scim"}]},{"group":"Okta","pages":[{"title":"SAML authentication with Okta","sidebarTitle":"SAML","href":"/admin/sso/okta/saml"},{"title":"SCIM provisioning with Okta","sidebarTitle":"SCIM","href":"/admin/sso/okta/scim"}]}]},{"group":"Deployment","pages":[{"title":"Overview","sidebarTitle":"Overview","href":"/admin/deployment/index"},{"title":"Deployment types","sidebarTitle":"Deployment types","href":"/admin/deployment/deployment-types"},{"title":"Deployment environments","sidebarTitle":"Deployment environments","href":"/admin/deployment/environments"},{"title":"Continuous deployment","href":"/admin/deployment/continuous-deployment"},{"title":"Custom domains","href":"/admin/deployment/custom-domains"},{"title":"Deployment warm-up","href":"/admin/deployment/warm-up"},{"title":"Auto-suspension","hidden":true,"href":"/admin/deployment/auto-suspension"},{"title":"Scalability","href":"/admin/deployment/scalability"},{"title":"Encryption keys","href":"/admin/deployment/encryption-keys"},{"title":"Limits and quotas","href":"/admin/deployment/limits"},{"title":"Infrastructure Options","href":"/admin/deployment/infrastructure"},{"group":"Dedicated Infrastructure","root":{"title":"Dedicated Infrastructure","href":"/admin/deployment/dedicated/index"},"pages":[{"group":"AWS","root":{"title":"Dedicated Infrastructure on AWS","sidebarTitle":"AWS","href":"/admin/deployment/dedicated/aws/index"},"pages":[{"title":"Setting up AWS PrivateLink","sidebarTitle":"PrivateLink","href":"/admin/deployment/dedicated/aws/private-link"},{"title":"Private API Connectivity on AWS","sidebarTitle":"Private API Connectivity","href":"/admin/deployment/dedicated/aws/private-api-connectivity"},{"title":"Bring Your Own Cloud on AWS","sidebarTitle":"BYOC","href":"/admin/deployment/dedicated/aws/byoc"}]},{"group":"Azure","root":{"title":"Dedicated Infrastructure on Azure","sidebarTitle":"Azure","href":"/admin/deployment/dedicated/azure/index"},"pages":[{"title":"Setting up Azure Private Link","sidebarTitle":"Private Link","href":"/admin/deployment/dedicated/azure/private-link"},{"title":"Bring Your Own Cloud on Azure","sidebarTitle":"BYOC","href":"/admin/deployment/dedicated/azure/byoc"}]},{"group":"GCP","root":{"title":"Dedicated Infrastructure on GCP","sidebarTitle":"GCP","href":"/admin/deployment/dedicated/gcp/index"},"pages":[{"title":"Setting up Google Private Service Connect","sidebarTitle":"Private Service Connect","href":"/admin/deployment/dedicated/gcp/private-service-connect"},{"title":"Bring Your Own Cloud on GCP","sidebarTitle":"BYOC","href":"/admin/deployment/dedicated/gcp/byoc"}]},{"title":"Bring-Your-Own Pre-aggregation Storage","sidebarTitle":"Pre-aggregation Storage","href":"/admin/deployment/dedicated/pre-aggregation-storage"}]},{"group":"Cube OIDC","root":{"title":"OIDC workload identity","sidebarTitle":"Overview","href":"/admin/deployment/oidc/index"},"pages":[{"title":"AWS","sidebarTitle":"AWS","href":"/admin/deployment/oidc/aws"},{"title":"GCP","sidebarTitle":"GCP","href":"/admin/deployment/oidc/gcp"},{"title":"Azure","sidebarTitle":"Azure","href":"/admin/deployment/oidc/azure"}]}]},{"group":"Monitoring","pages":[{"title":"Usage Analytics","href":"/admin/monitoring/usage-analytics"},{"title":"Query History","href":"/admin/monitoring/query-history"},{"title":"Pre-Aggregations","href":"/admin/monitoring/pre-aggregations"},{"title":"Performance Insights","href":"/admin/monitoring/performance"},{"title":"Audit Log","href":"/admin/monitoring/audit-log"},{"title":"Chats History","href":"/admin/monitoring/chats-history"},{"title":"Analyzing data from Query History export","sidebarTitle":"Query History export","href":"/admin/monitoring/query-history-export"},{"group":"Monitoring Integrations","root":{"title":"Overview","href":"/admin/monitoring/monitoring-integrations/index"},"pages":[{"title":"Integration with Amazon CloudWatch","sidebarTitle":"AWS CloudWatch","href":"/admin/monitoring/monitoring-integrations/cloudwatch"},{"title":"Integration with Amazon S3","sidebarTitle":"Amazon S3","href":"/admin/monitoring/monitoring-integrations/s3"},{"title":"Integration with Datadog","sidebarTitle":"Datadog","href":"/admin/monitoring/monitoring-integrations/datadog"},{"title":"Integration with Google Cloud Storage","sidebarTitle":"Google Cloud Storage","href":"/admin/monitoring/monitoring-integrations/gcs"},{"title":"Integration with Grafana Cloud","sidebarTitle":"Grafana Cloud","href":"/admin/monitoring/monitoring-integrations/grafana-cloud"},{"title":"Integration with New Relic","sidebarTitle":"New Relic","href":"/admin/monitoring/monitoring-integrations/new-relic"}]},{"title":"Alerts","href":"/admin/monitoring/alerts"}]},{"group":"AI","pages":[{"title":"Overview","href":"/admin/ai/index"},{"title":"Rules","href":"/admin/ai/rules"},{"title":"Certified queries","href":"/admin/ai/certified-queries"},{"title":"Skills","href":"/admin/ai/skills"},{"title":"Memories","href":"/admin/ai/memory-isolation"},{"title":"Multi-agent","href":"/admin/ai/multi-agent"},{"title":"Bring Your Own Model","sidebarTitle":"Bring Your Own Model","href":"/admin/ai/bring-your-own-model"},{"title":"MCP Connectors","href":"/admin/ai/mcp-connectors"},{"title":"Evals","href":"/admin/ai/evals"}]},{"group":"Account","pages":[{"group":"Customization","pages":[{"title":"App theme","href":"/admin/customization/app-theme"},{"title":"Chart palettes","href":"/admin/customization/chart-palettes"},{"title":"Dashboard themes","href":"/admin/customization/dashboard-themes"}]},{"title":"Time zones","href":"/admin/time-zones"},{"title":"AI Tokens","sidebarTitle":"AI Tokens","href":"/admin/account-billing/ai-tokens"},{"title":"API keys","href":"/admin/account-billing/api-keys"},{"title":"Billing FAQ","sidebarTitle":"Billing FAQ","href":"/admin/account-billing/billing-faq"},{"title":"Support in Cube Cloud","sidebarTitle":"Support","href":"/admin/account-billing/support"}]}]},{"tab":"Embedding","pages":[{"title":"Embedding","href":"/embedding"}]},{"tab":"Reference","pages":[{"title":"Reference","href":"/reference/data-modeling/cube"}]},{"tab":"Cube Core","pages":[{"title":"Cube Core","href":"/cube-core"}]},{"tab":"Recipes","pages":[{"title":"Recipes","href":"/recipes"}]},{"tab":"API","pages":[{"title":"API","href":"/api-reference/introduction"}]}]},"title":"Query tracing - Cube Documentation","buildId":"dpl_2xiSHD9XEvLsPGPcfoMtkLTB3dy9","deploymentId":"dpl_2xiSHD9XEvLsPGPcfoMtkLTB3dy9","dynamics":[],"chunks":[]}