This page provides guidance on identifying the source of query plan regressions.For any given SQL statement, if the cost-based optimizer chooses a new query plan that slows performance, you may observe an unexpected increase in query latency. This is considered a query plan regression. There are several reasons that the optimizer might choose a plan that increases execution time. This guide helps you understand, identify, and diagnose query plan regressions using built-in CockroachDB tools.
Query plan regressions only increase the execution time of SQL statements that use the affected plan. This means that the overall service latency of the cluster will only be affected during the execution of statements that are run with the problematic query plan.As a result, these latency spikes can be hard to identify. For example, if the problematic plan only affects a query that’s run on an infrequent, ad-hoc basis, it might be difficult to notice a pattern among the graphs on the Metrics page.To identify and fix query plan regressions, you must determine whether certain statement executions are associated with increased service latency. Next, check whether the statement’s query plan has changed. Finally, use CockroachDB tools to understand why the query plan changed, so you can confirm that the change directly caused the latency increase.
You might not be certain whether any particular SQL statement has experienced a query plan regression. However, if you’ve observed cluster activity that is slower than usual, noting specific time intervals or application uses associated with the latency can help identify problematic statements.
Notice a recent latency increase in your application
If you observe that your application is responding more slowly than usual, and this behavior isn’t explained by recent changes to table schemas, data, or cluster workloads, it’s worth considering a query plan regression.If performance slows at a particular time of day, note the time interval to help isolate SQL statements that typically run during that time.If instead the latency is associated with a particular action (for example, adding a new user), note the action. Then search through your application’s codebase to isolate SQL queries associated with that action.
Look at the graphs on the Overview Dashboard. By default, the graphs display cluster data from the past hour, but you can adjust this with the time interval selector.
Find the Service Latency: SQL Statements, 99th percentile graph. Use it to identify instances when service latency is higher than expected, based on typical use. This will depend on your own specific business and technical considerations.
If you notice an unexplained latency increase, it’s worth considering a query plan regression. Hover your cursor on the line in the graph at the beginning of the increase. The box that appears will indicate the time when the increase began.The above is a very clean example. Note that on a production cluster, an increase like this might be obscured by the normal latency of your cluster’s many other statement executions.
One way to track down query plan regressions is to identify SQL statements with relatively high execution latency. These statements may be associated with increased latency.
If you identified specific time intervals in Step 1, use the time interval selector to define a custom interval. Click Apply.
Among the resulting Statement Fingerprints, look for those with high latency. Sort the results by clicking the column headers for Statement Time or Max Latency.
Click on the Statement Fingerprint to go to the page that details the statement and its executions.
Look for statements whose Execution Count is high. Statements that are run once, such as IMPORT INTO statements, are unlikely to cause increased latency due to query plan regressions.
Scroll down to the Statement Times graph to view a visual representation of the statement’s execution times and how their latency has changed over time. A sudden increase with no clear explanation may be caused by a query plan regression.If you haven’t yet identified a specific point in time at which service latency increased, use this graph to do so for this SQL statement.
By now, you should have identified one or more statements with high execution time and the point when their latency began to increase. High latency isn’t always caused by a query plan regression, and some regressions may not increase latency enough to be detected by these methods. However, these methods can help identify high-impact query plan regressions in your cluster.
Step 3. Examine the query plans behind suspect statements
For each suspect SQL statement, determine whether the high latency is caused by a suboptimal query plan. Repeat the following steps for each statement you suspect may have experienced a query plan regression:
On the Statement Fingerprint page, click on the Explain Plans tab. The Explain Plans tab lists every unique query plan that was used for this statement fingerprint during the given time interval, along with relevant statistics for that plan’s executions. By default, these plans are sorted by Last Execution Time.
Use the time interval selector to create a custom time interval for the Explain Plans table. Create a time interval for the hour just after the statement’s latency increase. Click Apply.
Note which query plan was in use just after the latency increase, and record the values in the Plan Gist, Average Execution Time, and Average Rows Read columns.
Create another custom time interval for the hour just before the statement’s latency increase. Click Apply.
Note which query plan was in use just before the latency increase, and record the values in the Plan Gist, Average Execution Time, and Average Rows Read columns.
Compare the query plans.
If the newer plan matches the older plan (that is, it has the same plan gist), there was no query plan regression.If the newer plan differs from the older plan, the query plan has changed:
Compare the Average Execution Time of the two plans. If the newer plan’s average execution time is significantly higher than the older plan’s, it may indicate a query plan regression. It’s also possible that the increase in latency is coincidental, or that the plan change was not the actual cause. If the average execution time is approximately the same, or less, this plan change is unlikely to be a regression.
Compare the Average Rows Read of the two plans. If the newer plan’s value is significantly higher (such as an order of magnitude greater), it likely indicates a query plan regression. If the value for the newer plan is only moderately higher than the value for the older plan, it’s possible that this is due to a query plan regression, but it’s also possible that this is due to normal table growth. This increase may contribute to higher average execution time.
For all of the query plan statistics in the table, consider whether the newer query plan’s values are expected, based on your knowledge of the application and cluster workloads.
If multiple query plans were used before and after the latency increase, the SQL statement may have multiple valid query plans. This can occur when the optimizer chooses a plan based on literal values in the SQL query, those replaced by the ”_” placeholder in the statement fingerprint. The optimizer may decide that different plans are better for different literal values.With multiple valid query plans, you’re not just looking for a plan change, but for a shift in the distribution of plans used for the statement.
Look at the query plans that were used in the time interval after the latency increase. Note the values in the Execution Count column for each plan. Repeat the process for the interval before the latency increase. This will let you know not only if the same query plans were being used during both intervals, but also if their distributions changed. If the distribution shifts toward a plan with higher average execution time, it may indicate a query plan regression.
If you couldn’t identify a specific moment when latency increased, you won’t have a clear “before” and “after” to compare. In this case, it’s still helpful to have a general sense of when the increase occurred (using the methods from Step 1) even if the range spans several hours. You can then use the above methods (in Step 3) to compare query plans on a rolling basis by changing the custom time interval to consecutive hour-long intervals. This approach can help identify the specific interval when the latency spike occurred.
For any query plans whose increased execution time seems suspicious, investigate further to understand why the plan changed.
In the Explain Plans tab, click on the plan gist of the more recent plan to view its details.
Click on All Plans above to return to the full list.
Click on the plan gist of the previous plan to inspect it in more detail. Compare the two plans to understand what changed. They may use different indexes. They may also scan different parts of the table or use different join strategies.
Check the Used Indexes column for both the older and newer query plans. If these differ, it’s likely that the creation or deletion of an index resulted in a change to the statement’s query plan.
In the Explain Plans tab, click on the plan gist of the more recent plan to view its details. Identify the table(s) used in the initial “scan” step of the plan.
In your SQL client, run SHOW INDEXES FROM <table_name>; for each of those tables.
Make sure that the query plan is using a table index that makes sense, given the query and the table’s full set of indexes.
The new index may be well-chosen, but the schema change could have triggered a statistics refresh that caused the issue. It’s also possible that the new index is not ideal. Consider how and when the table is queried to determine whether the index should be reconsidered. Check the Insights page for index recommendations, and read more about secondary index best practices.
In the Explain Plans tab, click on the plan gist of the more recent plan to view its details. Identify the table used in the initial “scan” step of the plan.
In your SQL client, run SHOW STATISTICS FOR TABLE <table_name>; using that table name.The results will include statistics that were collected for each column in that table. The value in the “created” column of these results tells you when the statistics were collected. Compare the statistics of each table column across multiple timestamps. A change in the values of row_count, distinct_count, null_count, or other statistics may have affected planning. If the timestamp of the new statistics creation is associated with the time that the query plan changed, there may be a causal relationship between the two.
If you suspect that stale statistics caused the plan change and resulting latency increase, consider manually refreshing the table’s statistics.You may also want to consider the rare case in which sampling for histogram collection missed important values that would impact planning. You might want to increase the number of rows sampled for histograms before refreshing the table statistics.
Determine if a literal in the SQL statement has changed
If the SQL statement fingerprint contains placeholder values (”_”), a change in a literal may be responsible for a query plan regression. This is also worth considering in the case of multiple valid query plans, if a change in the distribution of plans has led to a higher average execution time.Inspect your application to determine whether the query literals are changing between executions.If you suspect the plan change caused the latency increase and was triggered by a changed query literal, table statistics may not accurately reflect how those values appear in the data. You may want to manually refresh the statistics for the table. It’s also possible that the current indexes aren’t effective for queries with the new literal value. In that case, check the Insights page for index recommendations.If the issue persists, a more substantial redesign of the schema or application may be required.
Go to the Events panel on the right. Scroll to the bottom, and click View All Events.
Scroll down to the approximate time when the latency increase began.Check for any events around that time that may have contributed to a query plan regression. These may include schema changes affecting tables in suspect SQL queries, modified cluster settings, created or dropped indexes, and more.An event around the time of the latency increase may have influenced how the optimizer selected query plans. Inspect changed cluster settings, or determine if the table indexes changed.
If your cluster recently underwent a CockroachDB version upgrade, note when that went into effect. An upgrade may have affected default cluster settings or planning heuristics in a way that caused a query plan regression. You may want to manually refresh the statistics for tables that are affected by a suspect SQL statement.
If none of the above methods are conclusive in diagnosing or fixing a query plan regression, consider activating diagnostics for the suspect statement fingerprints, or contact support.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"CockroachDB","colors":{"primary":"#9059FF","light":"#9059FF","dark":"#9059FF"},"logo":{"light":"https://mintcdn.com/cockroachlabs/4WvUnbVuGZfqM4kW/images/CockroachLabs_Wordmark_Black.png?fit=max\u0026auto=format\u0026n=4WvUnbVuGZfqM4kW\u0026q=85\u0026s=54ccae625c9986bf1df8ddc7b2c571f0","dark":"https://mintcdn.com/cockroachlabs/4WvUnbVuGZfqM4kW/images/CockroachLabs_Wordmark_White.png?fit=max\u0026auto=format\u0026n=4WvUnbVuGZfqM4kW\u0026q=85\u0026s=0dd9b66973a1c7d3dd72aa67b6094efe","href":"https://www.cockroachlabs.com/"},"favicon":{"light":"https://mintcdn.com/cockroachlabs/2yihO7vMXnL0G_07/images/favicon.svg?fit=max\u0026auto=format\u0026n=2yihO7vMXnL0G_07\u0026q=85\u0026s=01f9aa59c9f275e1f35cd424a27d2551","dark":"https://mintcdn.com/cockroachlabs/2yihO7vMXnL0G_07/images/favicon.svg?fit=max\u0026auto=format\u0026n=2yihO7vMXnL0G_07\u0026q=85\u0026s=01f9aa59c9f275e1f35cd424a27d2551"},"api":{"examples":{"defaults":"required","languages":["curl"]}},"appearance":{"default":"light"},"navbar":{"primary":{"type":"button","label":"Get started free","href":"https://cockroachlabs.cloud/signup?referralId=cc_nav_global\u0026_ga=2.242886210.1147139380.1759903632-41552699.1759903632"}},"footer":{"socials":{"youtube":"https://www.youtube.com/@cockroachdb","x":"https://x.com/CockroachDB","linkedin":"https://www.linkedin.com/company/cockroach-labs/mycompany/verification","instagram":"https://www.instagram.com/cockroachdb"},"links":[{"header":"Product","items":[{"label":"CockroachDB","href":"https://www.cockroachlabs.com/product"},{"label":"CockroachDB Cloud","href":"https://www.cockroachlabs.com/product/cockroachcloud"},{"label":"Compare","href":"https://www.cockroachlabs.com/compare"},{"label":"Pricing","href":"https://www.cockroachlabs.com/pricing"},{"label":"Get CockroachDB","href":"https://www.cockroachlabs.com/get-started-cockroachdb"},{"label":"Sign In","href":"https://cockroachlabs.cloud/"}]},{"header":"Resources","items":[{"label":"Guides","href":"https://resources.cockroachlabs.com/guides"},{"label":"Webinars","href":"https://www.cockroachlabs.com/community/webinars"},{"label":"Videos","href":"https://www.cockroachlabs.com/resources/video"},{"label":"Architecture Overview","href":"https://www.cockroachlabs.com/docs/stable/architecture/overview"},{"label":"FAQ","href":"https://www.cockroachlabs.com/docs/stable/frequently-asked-questions"},{"label":"Security","href":"https://www.cockroachlabs.com/security"}]},{"header":"Learn \u0026 Support","items":[{"label":"Docs","href":"https://www.cockroachlabs.com/docs"},{"label":"University","href":"https://learn.cockroachlabs.com/"},{"label":"Developers","href":"https://www.cockroachlabs.com/developers"},{"label":"Forum","href":"https://forum.cockroachlabs.com/"},{"label":"Slack","href":"https://cockroa.ch/slack"},{"label":"Support Portal","href":"https://support.cockroachlabs.com/hc/en-us"},{"label":"Contact Us","href":"https://www.cockroachlabs.com/contact"}]},{"header":"Company","items":[{"label":"About","href":"https://www.cockroachlabs.com/about"},{"label":"Blog","href":"https://www.cockroachlabs.com/blog"},{"label":"Careers","href":"https://www.cockroachlabs.com/careers"},{"label":"Customers","href":"https://www.cockroachlabs.com/customers"},{"label":"News","href":"https://www.cockroachlabs.com/press"},{"label":"Privacy","href":"https://www.cockroachlabs.com/privacy"},{"label":"Terms of Use","href":"https://www.cockroachlabs.com/website-terms-of-use"}]}]},"fonts":{"heading":{"family":"Poppins"},"body":{"family":"Open Sans"}},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}},"latex":true},"integrations":{"gtm":{"tagId":"GTM-NR8LC4"}},"errors":{"404":{"redirect":false,"title":"Page not found","description":"The page you're looking for doesn't exist. [Return to docs home](/index.html)."}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"interaction":{"drilldown":false},"navigation":{"global":{"anchors":[{"anchor":"University","icon":"graduation-cap","href":"https://learn.cockroachlabs.com/"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cockroachlabs","hasAudioNarration":false,"actualSubdomain":"cockroachlabs","customDomains":["docs.cockroachlabs.com"],"gitSource":{"type":"github","owner":"cockroachlabs","repo":"docs","deployBranch":"main","contentDirectory":"cockroachlabs-preview-main","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af4bb21d7a808c67a4ac795","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"CockroachDB","count":6951},{"language":"default","tag":"Docs","count":3217},{"language":"default","tag":"SQL","count":2566},{"language":"default","tag":"Statements","count":1714},{"language":"default","tag":"Self-Hosted Deployments","count":1457},{"language":"default","tag":"Reference","count":774},{"language":"default","tag":"Cloud Deployments","count":616},{"language":"default","tag":"Endpoints","count":528},{"language":"default","tag":"Cloud API Reference","count":518},{"language":"default","tag":"Get Started","count":441}],"searchSettings":{"isFiltersEnabled":true,"showContentSnippets":true,"fullPageSearch":true}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","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":"rbac-expansion","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":"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":"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":"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":"full-page-search","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":"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":"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":"turbopuffer-dual-write","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},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[{"filePath":"styles.css","content":":root{--inline-code-bg-light: rgb(var(--gray-200) / 0.92);--inline-code-bg-dark: rgb(255 255 255 / 0.08)}.prose :not(pre)>code{background-color:var(--inline-code-bg-light)!important}.dark .prose :not(pre)>code{background-color:var(--inline-code-bg-dark)!important}@media (min-width: 1536px){#navbar>.max-w-8xl,[class*=\"peer-[.is-not-custom]:peer-[.is-not-center]:max-w-8xl\"]{width:100%!important;max-width:none!important}}#navigation-items{display:flex;flex-direction:column}#navigation-items>ul:not(.sidebar-group){order:1;margin-top:1.5rem}.crdb-metrics-table table{table-layout:fixed!important;width:100%!important;min-width:0!important;max-width:100%!important;border-collapse:collapse}.crdb-metrics-table table td,.crdb-metrics-table table th{min-width:0!important;overflow-wrap:anywhere;word-break:break-word}.crdb-fixed-table table{table-layout:fixed!important;width:100%!important;min-width:0!important;max-width:100%!important;border-collapse:collapse}.crdb-fixed-table table td,.crdb-fixed-table table th{min-width:0!important;overflow-wrap:anywhere;word-break:break-word}.bg-cover{background-size:cover;background-repeat:no-repeat;background-position:center center}.bg-cover__bg-3-1{background-image:url(\"https://cockroach-labs-docs.imgix.net/bg-3-1.png?auto=format,compress\u0026w=1200\u0026q=40\")}.home-header{border-radius:0.5rem;margin-bottom:2rem!important;padding:2rem}.card{border:1px solid #e5e7eb;border-radius:0.75rem;background-color:white}.dark .card{background-color:#0d1117;border-color:rgba(255, 255, 255, 0.1)}.card-link{text-decoration:none!important;overflow:hidden}.card-link:hover{outline:1px solid rgba(105, 51, 255, 0.55);outline-offset:-1px}.card-link,.card-link:hover{transform:none!important;box-shadow:none!important}.card-link a,.card-link a:hover,.card-link h3,.card-link h3:hover,.card-link p,.card-link p:hover{border:0!important;text-decoration:none!important;transform:none!important}.card-link a{display:block;width:100%}.card-link h3{font-size:1rem!important;font-weight:600!important}.card-body{padding:1.5rem}.landing-column-title{margin-bottom:1rem}.overline{text-transform:uppercase;letter-spacing:0.05em}.btn-redirect{display:inline-flex;align-items:center;gap:0.5rem;padding:0.75rem 1.5rem;border:2px solid #e5e7eb;border-radius:0.5rem;text-decoration:none;transition:border-color 0.2s}.btn-redirect:hover{border-color:#6933ff}.btn-block{display:flex;width:100%;justify-content:center}.dark .btn-redirect{border-color:rgba(255, 255, 255, 0.1)}.article-section-title{font-size:1.25rem!important}.article-lists h3{font-size:0.875rem!important;font-weight:600!important;text-transform:uppercase;letter-spacing:0.05em;color:#6b7280!important}.dark .article-lists h3{color:#9ca3af!important}.article-lists ul{font-size:0.875rem}.shadow{box-shadow:0 0.5rem 1rem rgba(0, 0, 0, 0.15)}.bg-dark-wing{background-color:#152849;border-radius:0.5rem}.text-ice-temple{color:#1bf8ec!important;display:inline-flex;align-items:center;gap:0.375rem}.text-ice-temple img{display:inline-block;margin:0}.bg-dark-wing h2{font-size:clamp(1.25rem, 1rem + 1.5vw, 1.75rem)!important}@media (max-width: 576px){.card-body.bg-dark-wing{padding:1.25rem!important}}.text-decoration-none{text-decoration:none!important}.text-muted{color:#6b7280!important}.card-link .card-desc{font-size:0.9375rem!important;font-weight:400!important;line-height:1.5!important;text-align:left!important;color:#4b5563!important;width:100%;margin-top:0.5rem}.dark .card-link .card-desc{color:#9ca3af!important}.report-tag{display:inline-block;padding:0.25rem 0.75rem;border-radius:0.25rem;background-color:rgba(84, 42, 189, 0.08);color:#542abd}.dark .report-tag{background-color:rgba(84, 42, 189, 0.3);color:#b39dff}.resilience-report-img{background-image:url(\"/images/state-resilience.png\");background-size:cover;background-position:center;min-height:150px;border-radius:0.5rem}.row{display:flex!important;flex-wrap:wrap;margin-left:-0.75rem;margin-right:-0.75rem}.display-flex{display:flex!important}.col-lg-4{flex:0 0 auto;width:100%;padding-left:0.75rem;padding-right:0.75rem}@media (min-width: 992px){.col-lg-4{width:33.333333%!important}}.col-lg-3,.col-sm-6,.col-xs-12{flex:0 0 auto;width:100%!important;padding-left:0.75rem;padding-right:0.75rem}@media (min-width: 992px){.col-lg-3{width:25%!important}}@media (min-width: 576px){.col-sm-6{width:50%!important}}.col-12{width:100%!important}.col-lg-12{width:100%;padding-left:0.75rem;padding-right:0.75rem}@media (min-width: 992px){.col-lg-12{width:100%!important}}.col-md-4,.col-md-8{flex:0 0 auto;width:100%;padding-left:0.75rem;padding-right:0.75rem}@media (min-width: 768px){.col-md-4{width:33.333333%!important}.col-md-8{width:66.666667%!important}}.h-100{height:100%}.d-flex{display:flex}.flex-column{flex-direction:column}.mb-3{margin-bottom:1rem!important}.mb-5{margin-bottom:3rem!important}.pb-5{padding-bottom:3rem!important}.mb-xl-5{margin-bottom:3rem!important}.mt-auto{margin-top:auto!important}.mt-0{margin-top:0!important}.mt-2{margin-top:0.5rem!important}.mt-3{margin-top:1rem!important}.mt-5:not(.code-block){margin-top:3rem!important}.code-block.mb-8{margin-bottom:calc(var(--spacing) * 5)}.pt-5{padding-top:3rem!important}.m-0{margin:0!important}.ml-2{margin-left:0.5rem!important}.mb-0{margin-bottom:0!important}.mb-2{margin-bottom:0.5rem!important}.mb-4{margin-bottom:1.5rem!important}.p-2{padding:0.5rem!important}.p-3{padding:1rem!important}.p-4{padding:1.5rem!important}.pb-3{padding-bottom:1rem!important}.pb-4{padding-bottom:1.5rem!important}.ml-1{margin-left:0.25rem!important}.mr-auto{margin-right:auto!important}.justify-content-center{justify-content:center!important}.align-items-center{align-items:center!important}@media (min-width: 1200px){.p-xl-5{padding:3rem!important}}.mx-0{margin-left:0!important;margin-right:0!important}.text-center{text-align:center}.text-white{color:white!important}.text-black{color:black!important}.dark .text-black{color:white!important}.container{width:100%;max-width:1200px;margin-left:auto;margin-right:auto;padding-left:1rem;padding-right:1rem}.card-header-overlap-text{position:relative}@media (min-width: 768px){.p-md-5{padding:3rem!important}}@media (min-width: 992px){.d-lg-flex{display:flex!important}.mb-lg-0{margin-bottom:0!important}}.prose table{border-collapse:collapse!important}.prose table th,.prose table td{border:1px solid rgb(var(--gray-200))!important}.dark .prose table th,.dark .prose table td{border-color:rgb(var(--gray-700) / 0.5)!important}.prose table th{padding:0.571429em;font-weight:600;vertical-align:bottom;color:var(--tw-prose-headings);text-align:left}.prose table th.center-align{text-align:center}.prose table td{padding:0.571429em;vertical-align:baseline}[data-component-part=\"accordion-description\"]{font-size:0.875rem!important}.accordion.mb-3{margin-bottom:0.25rem!important}@media (max-width: 991.98px){[id^=\"kapa-widget-container\"] button{width:36px!important;height:36px!important;min-width:36px!important;padding:0!important;font-size:0!important}[id^=\"kapa-widget-container\"] button svg{width:18px!important;height:18px!important}[id^=\"kapa-widget-container\"] button span{display:none!important}}table.crdb-fixed-table{table-layout:fixed!important;min-width:0!important;width:100%}table.crdb-fixed-table td,table.crdb-fixed-table th{min-width:0!important;overflow-wrap:break-word;word-break:normal}.sql-grammar svg .line{fill:none;stroke:#262626}.sql-grammar svg .bold-line{stroke:#0A0A0A;shape-rendering:crispEdges;stroke-width:2}.sql-grammar svg .thin-line{stroke:#0F0F0F;shape-rendering:crispEdges}.sql-grammar svg .filled{fill:#262626;stroke:none}.sql-grammar svg text.terminal{font-family:Verdana, Sans-serif;font-size:12px;fill:#0A0A0A;font-weight:bold}.sql-grammar svg text.nonterminal{font-family:Verdana, Sans-serif;font-size:12px;fill:#0055FF}.sql-grammar svg text.regexp{font-family:Verdana, Sans-serif;font-size:12px;fill:#0F0F0F}.sql-grammar svg rect,.sql-grammar svg circle,.sql-grammar svg polygon{fill:#262626;stroke:#262626}.sql-grammar svg rect.terminal{fill:#ffffff;stroke:#262626}.sql-grammar svg rect.nonterminal{fill:#FFFFFF;stroke:#262626}.sql-grammar svg rect.text{fill:none;stroke:none}.sql-grammar svg polygon.regexp{fill:#FFFFFF;stroke:#262626}.sql-grammar svg{background-color:#ffffff}.sql-grammar a[name]::before{content:'';display:block;height:80px;margin:-80px 0 0}.sql-grammar a[name]:focus{outline:0}pre[language=\"sql\"][data-crdb-prompt-stripped] code::before{content:\"> \";color:#94e2d5;user-select:none}.mark-yes{color:#008a5e;font-weight:600}.dark .mark-yes{color:#3ddc97}"},{"filePath":"collapse-nav.css","content":"html:not(.crl-nav-off) [data-layout-item=\"sidebar\"] li[data-title]:not([data-active]):not([data-crl-keep])>button+ul,html:not(.crl-nav-off) [data-layout-item=\"mobile-nav\"] li[data-title]:not([data-active]):not([data-crl-keep])>button+ul{display:none}html:not(.crl-nav-off) [data-layout-item=\"sidebar\"] li[data-title]:not([data-active]):not([data-crl-keep])>button svg,html:not(.crl-nav-off) [data-layout-item=\"mobile-nav\"] li[data-title]:not([data-active]):not([data-crl-keep])>button svg{rotate:none!important;transform:none!important}"}],"page":{"pagePath":"docs/v26.1/troubleshoot-query-plan-regressions","slug":"/docs/v26.1/troubleshoot-query-plan-regressions","pageMetadata":{"title":"Troubleshoot Query Plan Regressions","old_description":"Troubleshooting guide for when the cost-based optimizer chooses a new query plan that slows performance.","canonical":"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions","description":null,"href":"/docs/v26.1/troubleshoot-query-plan-regressions"},"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`,ol:`ol`,p:`p`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{Heading,OptimizedImage,Tip}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`This page provides guidance on identifying the source of `,_jsx(_components.a,{href:`/docs/v26.1/cost-based-optimizer`,children:`query plan`}),` regressions.`]}),`\n`,_jsxs(_components.p,{children:[`For any given SQL statement, if the `,_jsx(_components.a,{href:`/docs/v26.1/cost-based-optimizer`,children:`cost-based optimizer`}),` chooses a new query plan that slows performance, you may observe an unexpected increase in query latency. This is considered a query plan regression. There are several reasons that the optimizer might choose a plan that increases execution time. This guide helps you understand, identify, and diagnose query plan regressions using built-in CockroachDB tools.`]}),`\n`,_jsx(Heading,{level:`2`,id:`before-you-begin`,children:`Before you begin`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/docs/v26.1/cost-based-optimizer`,children:`Understand how the cost-based optimizer chooses query plans`}),` based on table statistics and how those statistics are refreshed.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`what-to-look-out-for`,children:`What to look out for`}),`\n`,_jsx(_components.p,{children:`Query plan regressions only increase the execution time of SQL statements that use the affected plan. This means that the overall service latency of the cluster will only be affected during the execution of statements that are run with the problematic query plan.`}),`\n`,_jsxs(_components.p,{children:[`As a result, these latency spikes can be hard to identify. For example, if the problematic plan only affects a query that’s run on an infrequent, ad-hoc basis, it might be difficult to notice a pattern among the graphs on the `,_jsxs(_components.a,{href:`/docs/v26.1/ui-overview#metrics`,children:[_jsx(_components.strong,{children:`Metrics`}),` page`]}),`.`]}),`\n`,_jsx(_components.p,{children:`To identify and fix query plan regressions, you must determine whether certain statement executions are associated with increased service latency. Next, check whether the statement’s query plan has changed. Finally, use CockroachDB tools to understand why the query plan changed, so you can confirm that the change directly caused the latency increase.`}),`\n`,_jsx(Heading,{level:`2`,id:`troubleshooting`,children:`Troubleshooting`}),`\n`,_jsx(Heading,{level:`3`,id:`step-1-observe-high-cluster-latency`,children:`Step 1. Observe high cluster latency`}),`\n`,_jsx(_components.p,{children:`You might not be certain whether any particular SQL statement has experienced a query plan regression. However, if you’ve observed cluster activity that is slower than usual, noting specific time intervals or application uses associated with the latency can help identify problematic statements.`}),`\n`,_jsx(Heading,{level:`4`,id:`notice-a-recent-latency-increase-in-your-application`,children:`Notice a recent latency increase in your application`}),`\n`,_jsx(_components.p,{children:`If you observe that your application is responding more slowly than usual, and this behavior isn’t explained by recent changes to table schemas, data, or cluster workloads, it’s worth considering a query plan regression.`}),`\n`,_jsx(_components.p,{children:`If performance slows at a particular time of day, note the time interval to help isolate SQL statements that typically run during that time.`}),`\n`,_jsx(_components.p,{children:`If instead the latency is associated with a particular action (for example, adding a new user), note the action. Then search through your application’s codebase to isolate SQL queries associated with that action.`}),`\n`,_jsx(Heading,{level:`4`,id:`identify-trends-in-cluster-metrics`,children:`Identify trends in cluster metrics`}),`\n`,_jsx(_components.p,{children:`Knowing what service latency to expect, based on your cluster’s usual activity, makes it easier to notice deviations from healthy cluster activity.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Open the `,_jsx(_components.a,{href:`/docs/v26.1/ui-overview`,children:`DB Console`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Go to the `,_jsxs(_components.a,{href:`/docs/v26.1/ui-overview#metrics`,children:[_jsx(_components.strong,{children:`Metrics`}),` page`]}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Look at the graphs on the `,_jsx(_components.a,{href:`/docs/v26.1/ui-overview-dashboard`,children:_jsx(_components.strong,{children:`Overview Dashboard`})}),`. By default, the graphs display cluster data from the past hour, but you can adjust this with the time interval selector.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Find the `,_jsx(_components.strong,{children:`Service Latency: SQL Statements, 99th percentile`}),` graph. Use it to identify instances when service latency is higher than expected, based on typical use. This will depend on your own specific business and technical considerations.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`If you notice an unexplained latency increase, it’s worth considering a query plan regression. Hover your cursor on the line in the graph at the beginning of the increase. The box that appears will indicate the time when the increase began.`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/cockroachlabs/iiBVxthghoAOO3UM/images/common/troubleshooting-query-plan-regressions-1.png?fit=max\u0026auto=format\u0026n=iiBVxthghoAOO3UM\u0026q=85\u0026s=d04283b05cb27706fa3ee9e90b43d745`,alt:`Query Plan Regression metrics graph`,\"data-og-width\":`1928`,width:`1928`,\"data-og-height\":`818`,height:`818`,\"data-path\":`images/common/troubleshooting-query-plan-regressions-1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cockroachlabs/iiBVxthghoAOO3UM/images/common/troubleshooting-query-plan-regressions-1.png?w=280\u0026fit=max\u0026auto=format\u0026n=iiBVxthghoAOO3UM\u0026q=85\u0026s=4822a784eff99d40c75154f0c693bde5 280w, https://mintcdn.com/cockroachlabs/iiBVxthghoAOO3UM/images/common/troubleshooting-query-plan-regressions-1.png?w=560\u0026fit=max\u0026auto=format\u0026n=iiBVxthghoAOO3UM\u0026q=85\u0026s=132e323042d9eae9c7cfdce1dd73fb88 560w, https://mintcdn.com/cockroachlabs/iiBVxthghoAOO3UM/images/common/troubleshooting-query-plan-regressions-1.png?w=840\u0026fit=max\u0026auto=format\u0026n=iiBVxthghoAOO3UM\u0026q=85\u0026s=5367223a91203965dde0cf2d815db834 840w, https://mintcdn.com/cockroachlabs/iiBVxthghoAOO3UM/images/common/troubleshooting-query-plan-regressions-1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=iiBVxthghoAOO3UM\u0026q=85\u0026s=13e430b991e686eafa7e2782defdd170 1100w, https://mintcdn.com/cockroachlabs/iiBVxthghoAOO3UM/images/common/troubleshooting-query-plan-regressions-1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=iiBVxthghoAOO3UM\u0026q=85\u0026s=112a2ee6eff8ab3e19f24412b88ab764 1650w, https://mintcdn.com/cockroachlabs/iiBVxthghoAOO3UM/images/common/troubleshooting-query-plan-regressions-1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=iiBVxthghoAOO3UM\u0026q=85\u0026s=6e08c8a4dc9eeaed1b4eae3811eb3bbe 2500w`}),`\n`,_jsx(_components.p,{children:`The above is a very clean example. Note that on a production cluster, an increase like this might be obscured by the normal latency of your cluster’s many other statement executions.`}),`\n`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`step-2-identify-high-latency-statements`,children:`Step 2. Identify high-latency statements`}),`\n`,_jsx(_components.p,{children:`One way to track down query plan regressions is to identify SQL statements with relatively high execution latency. These statements may be associated with increased latency.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Go to the `,_jsxs(_components.a,{href:`/docs/v26.1/ui-statements-page`,children:[_jsx(_components.strong,{children:`SQL Activity`}),` > `,_jsx(_components.strong,{children:`Statements`}),` page`]}),` in the DB Console.`]}),`\n`,_jsxs(_components.li,{children:[`If you identified specific time intervals in Step 1, use the time interval selector to define a custom interval. Click `,_jsx(_components.strong,{children:`Apply`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Among the resulting Statement Fingerprints, look for those with high latency. Sort the results by clicking the column headers for `,_jsx(_components.strong,{children:`Statement Time`}),` or `,_jsx(_components.strong,{children:`Max Latency`}),`.`]}),`\n`,_jsx(_components.li,{children:`Click on the Statement Fingerprint to go to the page that details the statement and its executions.`}),`\n`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Look for statements whose `,_jsx(_components.strong,{children:`Execution Count`}),` is high. Statements that are run once, such as `,_jsx(_components.a,{href:`/docs/v26.1/import-into`,children:_jsx(_components.code,{children:`IMPORT INTO`})}),` statements, are unlikely to cause increased latency due to query plan regressions.`]})}),`\n`,_jsxs(_components.ol,{start:`5`,children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Scroll down to the `,_jsx(_components.strong,{children:`Statement Times`}),` graph to view a visual representation of the statement’s execution times and how their latency has changed over time. A sudden increase with no clear explanation may be caused by a query plan regression.`]}),`\n`,_jsx(_components.p,{children:`If you haven’t yet identified a specific point in time at which service latency increased, use this graph to do so for this SQL statement.`}),`\n`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`By now, you should have identified one or more statements with high execution time and the point when their latency began to increase. High latency isn’t always caused by a query plan regression, and some regressions may not increase latency enough to be detected by these methods. However, these methods can help identify high-impact query plan regressions in your cluster.`}),`\n`,_jsx(Heading,{level:`3`,id:`step-3-examine-the-query-plans-behind-suspect-statements`,children:`Step 3. Examine the query plans behind suspect statements`}),`\n`,_jsx(_components.p,{children:`For each suspect SQL statement, determine whether the high latency is caused by a suboptimal query plan. Repeat the following steps for each statement you suspect may have experienced a query plan regression:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`On the Statement Fingerprint page, click on the `,_jsxs(_components.a,{href:`/docs/v26.1/ui-statements-page#explain-plans`,children:[_jsx(_components.strong,{children:`Explain Plans`}),` tab`]}),`. The `,_jsx(_components.strong,{children:`Explain Plans`}),` tab lists every unique query plan that was used for this statement fingerprint during the given time interval, along with relevant statistics for that plan’s executions. By default, these plans are sorted by `,_jsx(_components.strong,{children:`Last Execution Time`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Use the time interval selector to create a custom time interval for the Explain Plans table. Create a time interval for the hour just after the statement’s latency increase. Click `,_jsx(_components.strong,{children:`Apply`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Note which query plan was in use just after the latency increase, and record the values in the `,_jsx(_components.strong,{children:`Plan Gist`}),`, `,_jsx(_components.strong,{children:`Average Execution Time`}),`, and `,_jsx(_components.strong,{children:`Average Rows Read`}),` columns.`]}),`\n`,_jsxs(_components.li,{children:[`Create another custom time interval for the hour just before the statement’s latency increase. Click `,_jsx(_components.strong,{children:`Apply`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Note which query plan was in use just before the latency increase, and record the values in the `,_jsx(_components.strong,{children:`Plan Gist`}),`, `,_jsx(_components.strong,{children:`Average Execution Time`}),`, and `,_jsx(_components.strong,{children:`Average Rows Read`}),` columns.`]}),`\n`,_jsx(_components.li,{children:`Compare the query plans.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`If the newer plan matches the older plan (that is, it has the same plan gist), there was no query plan regression.`}),`\n`,_jsx(_components.p,{children:`If the newer plan differs from the older plan, the query plan has changed:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Compare the `,_jsx(_components.strong,{children:`Average Execution Time`}),` of the two plans. If the newer plan’s average execution time is significantly higher than the older plan’s, it may indicate a query plan regression. It’s also possible that the increase in latency is coincidental, or that the plan change was not the actual cause. If the average execution time is approximately the same, or less, this plan change is unlikely to be a regression.`]}),`\n`,_jsxs(_components.li,{children:[`Compare the `,_jsx(_components.strong,{children:`Average Rows Read`}),` of the two plans. If the newer plan’s value is significantly higher (such as an order of magnitude greater), it likely indicates a query plan regression. If the value for the newer plan is only moderately higher than the value for the older plan, it’s possible that this is due to a query plan regression, but it’s also possible that this is due to normal table growth. This increase may contribute to higher average execution time.`]}),`\n`,_jsx(_components.li,{children:`For all of the query plan statistics in the table, consider whether the newer query plan’s values are expected, based on your knowledge of the application and cluster workloads.`}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`multiple-valid-query-plans`,children:`Multiple valid query plans`}),`\n`,_jsx(_components.p,{children:`If multiple query plans were used before and after the latency increase, the SQL statement may have multiple valid query plans. This can occur when the optimizer chooses a plan based on literal values in the SQL query, those replaced by the ”_” placeholder in the statement fingerprint. The optimizer may decide that different plans are better for different literal values.`}),`\n`,_jsxs(_components.p,{children:[`With multiple valid query plans, you’re not just looking for a plan change, but for a shift in the `,_jsx(_components.em,{children:`distribution of plans`}),` used for the statement.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Look at the query plans that were used in the time interval after the latency increase. Note the values in the `,_jsx(_components.strong,{children:`Execution Count`}),` column for each plan. Repeat the process for the interval before the latency increase. This will let you know not only if the same query plans were being used during both intervals, but also if their distributions changed. If the distribution shifts toward a plan with higher average execution time, it may indicate a query plan regression.`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`If you couldn’t identify a specific moment when latency increased, you won’t have a clear “before” and “after” to compare. In this case, it’s still helpful to have a general sense of when the increase occurred (using the methods from Step 1) even if the range spans several hours. You can then use the above methods (in Step 3) to compare query plans on a rolling basis by changing the custom time interval to consecutive hour-long intervals. This approach can help identify the specific interval when the latency spike occurred.`})}),`\n`,_jsx(Heading,{level:`3`,id:`step-4-understand-why-the-query-plan-changed`,children:`Step 4. Understand why the query plan changed`}),`\n`,_jsx(_components.p,{children:`For any query plans whose increased execution time seems suspicious, investigate further to understand why the plan changed.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`In the `,_jsx(_components.strong,{children:`Explain Plans`}),` tab, click on the plan gist of the more recent plan to view its details.`]}),`\n`,_jsxs(_components.li,{children:[`Click on `,_jsx(_components.strong,{children:`All Plans`}),` above to return to the full list.`]}),`\n`,_jsx(_components.li,{children:`Click on the plan gist of the previous plan to inspect it in more detail. Compare the two plans to understand what changed. They may use different indexes. They may also scan different parts of the table or use different join strategies.`}),`\n`]}),`\n`,_jsx(Heading,{level:`4`,id:`determine-if-the-table-indexes-changed`,children:`Determine if the table indexes changed`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Check the `,_jsx(_components.strong,{children:`Used Indexes`}),` column for both the older and newer query plans. If these differ, it’s likely that the creation or deletion of an index resulted in a change to the statement’s query plan.`]}),`\n`,_jsxs(_components.li,{children:[`In the `,_jsx(_components.strong,{children:`Explain Plans`}),` tab, click on the plan gist of the more recent plan to view its details. Identify the table(s) used in the initial “scan” step of the plan.`]}),`\n`,_jsxs(_components.li,{children:[`In your SQL client, run `,_jsx(_components.code,{children:`SHOW INDEXES FROM \u003ctable_name>;`}),` for each of those tables.`]}),`\n`,_jsx(_components.li,{children:`Make sure that the query plan is using a table index that makes sense, given the query and the table’s full set of indexes.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`The new index may be well-chosen, but the schema change could have triggered a statistics refresh that caused the issue. It’s also possible that the new index is not ideal. Consider how and when the table is queried to determine whether the index should be reconsidered. `,_jsxs(_components.a,{href:`/docs/v26.1/ui-insights-page#suboptimal-plan`,children:[`Check the `,_jsx(_components.strong,{children:`Insights`}),` page for index recommendations`]}),`, and read more about `,_jsx(_components.a,{href:`/docs/v26.1/schema-design-indexes#best-practices`,children:`secondary index best practices`}),`.`]}),`\n`,_jsx(Heading,{level:`4`,id:`determine-if-the-table-statistics-changed`,children:`Determine if the table statistics changed`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`In the `,_jsx(_components.strong,{children:`Explain Plans`}),` tab, click on the plan gist of the more recent plan to view its details. Identify the table used in the initial “scan” step of the plan.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`In your SQL client, run `,_jsx(_components.code,{children:`SHOW STATISTICS FOR TABLE \u003ctable_name>;`}),` using that table name.`]}),`\n`,_jsxs(_components.p,{children:[`The results will include statistics that were collected for each column in that table. The value in the “created” column of these results tells you when the statistics were collected. Compare the statistics of each table column across multiple timestamps. A change in the values of `,_jsx(_components.code,{children:`row_count`}),`, `,_jsx(_components.code,{children:`distinct_count`}),`, `,_jsx(_components.code,{children:`null_count`}),`, or other statistics may have affected planning. If the timestamp of the new statistics creation is associated with the time that the query plan changed, there may be a causal relationship between the two.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`If you suspect that stale statistics caused the plan change and resulting latency increase, consider `,_jsx(_components.a,{href:`/docs/v26.1/create-statistics#examples`,children:`manually refreshing the table’s statistics`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`You may also want to consider the rare case in which sampling for `,_jsx(_components.a,{href:`/docs/v26.1/cost-based-optimizer#control-histogram-collection`,children:`histogram`}),` collection missed important values that would impact planning. You might want to increase the `,_jsx(_components.a,{href:`/docs/v26.1/cluster-settings#setting-sql-stats-histogram-samples-count`,children:`number of rows sampled for histograms`}),` before refreshing the table statistics.`]}),`\n`,_jsx(Heading,{level:`4`,id:`determine-if-a-literal-in-the-sql-statement-has-changed`,children:`Determine if a literal in the SQL statement has changed`}),`\n`,_jsxs(_components.p,{children:[`If the SQL statement fingerprint contains placeholder values (”_”), a change in a literal may be responsible for a query plan regression. This is also worth considering in the case of `,_jsx(_components.a,{href:`#multiple-valid-query-plans`,children:`multiple valid query plans`}),`, if a change in the distribution of plans has led to a higher average execution time.`]}),`\n`,_jsx(_components.p,{children:`Inspect your application to determine whether the query literals are changing between executions.`}),`\n`,_jsxs(_components.p,{children:[`If you suspect the plan change caused the latency increase and was triggered by a changed query literal, table statistics may not accurately reflect how those values appear in the data. You may want to `,_jsx(_components.a,{href:`/docs/v26.1/create-statistics#examples`,children:`manually refresh the statistics for the table`}),`. It’s also possible that the current indexes aren’t effective for queries with the new literal value. In that case, `,_jsxs(_components.a,{href:`/docs/v26.1/ui-insights-page#suboptimal-plan`,children:[`check the `,_jsx(_components.strong,{children:`Insights`}),` page for index recommendations`]}),`.`]}),`\n`,_jsx(_components.p,{children:`If the issue persists, a more substantial redesign of the schema or application may be required.`}),`\n`,_jsx(Heading,{level:`4`,id:`view-all-events`,children:`View all events`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Go to the `,_jsxs(_components.a,{href:`/docs/v26.1/ui-overview#metrics`,children:[_jsx(_components.strong,{children:`Metrics`}),` page`]}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Go to the `,_jsxs(_components.a,{href:`/docs/v26.1/ui-runtime-dashboard#events-panel`,children:[_jsx(_components.strong,{children:`Events`}),` panel`]}),` on the right. Scroll to the bottom, and click `,_jsx(_components.strong,{children:`View All Events`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsx(_components.p,{children:`Scroll down to the approximate time when the latency increase began.`}),`\n`,_jsxs(_components.p,{children:[`Check for any events around that time that may have contributed to a query plan regression. These may include schema changes affecting tables in suspect SQL queries, `,_jsx(_components.a,{href:`/docs/v26.1/set-cluster-setting`,children:`modified cluster settings`}),`, created or dropped indexes, and more.`]}),`\n`,_jsxs(_components.p,{children:[`An event around the time of the latency increase may have influenced how the optimizer selected query plans. Inspect changed cluster settings, or `,_jsx(_components.a,{href:`#determine-if-the-table-indexes-changed`,children:`determine if the table indexes changed`}),`.`]}),`\n`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`If your cluster recently underwent a CockroachDB version upgrade, note when that went into effect. An upgrade may have affected default cluster settings or planning heuristics in a way that caused a query plan regression. You may want to `,_jsx(_components.a,{href:`/docs/v26.1/create-statistics#examples`,children:`manually refresh the statistics for tables`}),` that are affected by a suspect SQL statement.`]})}),`\n`,_jsxs(_components.p,{children:[`If none of the above methods are conclusive in diagnosing or fixing a query plan regression, consider `,_jsx(_components.a,{href:`/docs/v26.1/ui-statements-page#diagnostics`,children:`activating diagnostics`}),` for the suspect statement fingerprints, or `,_jsx(_components.a,{href:`/docs/v26.1/support-resources`,children:`contact support`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`see-also`,children:`See also`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/docs/v26.1/cost-based-optimizer`,children:`Cost-Based Optimizer`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/docs/v26.1/ui-insights-page`,children:`Insights Page`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/docs/v26.1/troubleshooting-overview`,children:`Troubleshooting Overview`})}),`\n`,_jsx(_components.li,{children:_jsx(_components.a,{href:`/docs/v26.1/support-resources`,children:`Support Resources`})}),`\n`]})]})}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":{"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}},"config":{},"pageMetadata":{"title":"Troubleshoot Query Plan Regressions","old_description":"Troubleshooting guide for when the cost-based optimizer chooses a new query plan that slows performance.","canonical":"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions","description":null,"href":"/docs/v26.1/troubleshoot-query-plan-regressions"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Before you begin","slug":"before-you-begin","depth":2,"children":[]},{"title":"What to look out for","slug":"what-to-look-out-for","depth":2,"children":[]},{"title":"Troubleshooting","slug":"troubleshooting","depth":2,"children":[{"title":"Step 1. Observe high cluster latency","slug":"step-1-observe-high-cluster-latency","depth":3,"children":[]},{"title":"Notice a recent latency increase in your application","slug":"notice-a-recent-latency-increase-in-your-application","depth":4,"children":[]},{"title":"Identify trends in cluster metrics","slug":"identify-trends-in-cluster-metrics","depth":4,"children":[]},{"title":"Step 2. Identify high-latency statements","slug":"step-2-identify-high-latency-statements","depth":3,"children":[]},{"title":"Step 3. Examine the query plans behind suspect statements","slug":"step-3-examine-the-query-plans-behind-suspect-statements","depth":3,"children":[]},{"title":"Multiple valid query plans","slug":"multiple-valid-query-plans","depth":4,"children":[]},{"title":"Step 4. Understand why the query plan changed","slug":"step-4-understand-why-the-query-plan-changed","depth":3,"children":[]},{"title":"Determine if the table indexes changed","slug":"determine-if-the-table-indexes-changed","depth":4,"children":[]},{"title":"Determine if the table statistics changed","slug":"determine-if-the-table-statistics-changed","depth":4,"children":[]},{"title":"Determine if a literal in the SQL statement has changed","slug":"determine-if-a-literal-in-the-sql-statement-has-changed","depth":4,"children":[]},{"title":"View all events","slug":"view-all-events","depth":4,"children":[]}]},{"title":"See also","slug":"see-also","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/cockroachlabs/4695317e415d4eba/kapa.js","/_mintlify/custom/cockroachlabs/40fb45a3cfe42c92/copy-code-prompt.js","/_mintlify/custom/cockroachlabs/3f343c9e8c40397a/collapse-nav.js"],"subdomain":"cockroachlabs","siteName":"CockroachDB","title":"Troubleshoot Query Plan Regressions - CockroachDB","navMaps":{"firstHrefInVersion":{"v26.4":{"href":"/docs/stable/troubleshoot-query-plan-regressions","matchLevel":1},"v26.3":{"href":"/docs/v26.3/troubleshoot-query-plan-regressions","matchLevel":1,"canonicalOverride":true},"v26.2":{"href":"/docs/v26.2/troubleshoot-query-plan-regressions","matchLevel":1,"canonicalOverride":true},"v26.1":{"href":"/docs/v26.1/troubleshoot-query-plan-regressions","matchLevel":0},"v25.4":{"href":"/docs/v25.4/troubleshoot-query-plan-regressions","matchLevel":1,"canonicalOverride":true},"v25.3":{"href":"/docs/v25.3/troubleshooting-overview","matchLevel":2},"v25.2":{"href":"/docs/v25.2/troubleshooting-overview","matchLevel":2},"v25.1":{"href":"/docs/v25.1/troubleshooting-overview","matchLevel":2},"v24.3":{"href":"/docs/v24.3/troubleshooting-overview","matchLevel":2},"v24.1":{"href":"/docs/v24.1/troubleshooting-overview","matchLevel":2},"v23.2":{"href":"/docs/v23.2/troubleshooting-overview","matchLevel":2},"v23.1":{"href":"/docs/v23.1/troubleshooting-overview","matchLevel":2}},"firstHrefInLanguage":{}},"lastModified":"2026-11-11T19:18:29.271Z","originalFileLocation":"docs/v26.1/troubleshoot-query-plan-regressions.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=\"light\"}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=\"application-name\" content=\"CockroachDB\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/cockroachlabs/c9BlkJ0WBi2Ma7w-/_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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/cockroachlabs/c9BlkJ0WBi2Ma7w-/_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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Troubleshoot Query Plan Regressions - CockroachDB\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"CockroachDB\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cockroachlabs.mintlify.site/_mintlify/api/og/v2?division=Troubleshooting\u0026amp;title=Troubleshoot+Query+Plan+Regressions\u0026amp;theme=4aeed7318cb28bd50868adb3\u0026amp;signature=304c1bc902ea9152ceaaba81626537e9e15fd9497060afa81b8122ea5ffa349c\">\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=\"Troubleshoot Query Plan Regressions - CockroachDB\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cockroachlabs.mintlify.site/_mintlify/api/og/v2?division=Troubleshooting\u0026amp;title=Troubleshoot+Query+Plan+Regressions\u0026amp;theme=4aeed7318cb28bd50868adb3\u0026amp;signature=304c1bc902ea9152ceaaba81626537e9e15fd9497060afa81b8122ea5ffa349c\">\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/cockroachlabs/c9BlkJ0WBi2Ma7w-/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"CockroachDB\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#9059FF\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/v26.1/troubleshoot-query-plan-regressions.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.cockroachlabs.com/#organization\",\"name\":\"CockroachDB\",\"url\":\"https://docs.cockroachlabs.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/cockroachlabs/4WvUnbVuGZfqM4kW/images/CockroachLabs_Wordmark_Black.png?fit=max\u0026auto=format\u0026n=4WvUnbVuGZfqM4kW\u0026q=85\u0026s=54ccae625c9986bf1df8ddc7b2c571f0\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.cockroachlabs.com#website\",\"name\":\"CockroachDB\",\"url\":\"https://docs.cockroachlabs.com\",\"publisher\":{\"@id\":\"https://docs.cockroachlabs.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions#webpage\",\"url\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions\",\"name\":\"Troubleshoot Query Plan Regressions\",\"dateModified\":\"2026-11-11T19:18:29.271Z\",\"isPartOf\":{\"@id\":\"https://docs.cockroachlabs.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Troubleshooting\",\"item\":\"https://docs.cockroachlabs.com/docs/v26.1/troubleshooting-overview\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Troubleshoot Query Plan Regressions\",\"item\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions#article\",\"headline\":\"Troubleshoot Query Plan Regressions\",\"name\":\"Troubleshoot Query Plan Regressions\",\"url\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions\",\"mainEntityOfPage\":{\"@id\":\"https://docs.cockroachlabs.com/docs/stable/troubleshoot-query-plan-regressions#webpage\"},\"dateModified\":\"2026-11-11T19:18:29.271Z\",\"publisher\":{\"@id\":\"https://docs.cockroachlabs.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.cockroachlabs.com#website\"}}]}\u003c/script>","agentPointerHref":"/docs/v26.1/troubleshoot-query-plan-regressions.md","siteName":"CockroachDB","nav":{"global":{"anchors":[{"anchor":"University","icon":"graduation-cap","href":"https://learn.cockroachlabs.com/"}]},"products":[{"product":"Cockroach Continuum Cloud","icon":"https://mintlify.s3.us-west-1.amazonaws.com/cockroachlabs/images/continuum/cockroachlabs-symbol.svg","description":"The agentic database cloud","pages":[{"title":"Cockroach Continuum Cloud","href":"/docs/continuum"}]},{"product":"CockroachDB","icon":"database","description":"Distributed SQL database","versions":[{"version":"v26.4","default":true,"tag":"Stable","pages":[{"title":"v26.4","href":"/docs/stable/troubleshoot-query-plan-regressions"}]},{"version":"v26.3","pages":[{"title":"v26.3","href":"/docs/v26.3/troubleshoot-query-plan-regressions"}]},{"version":"v26.2","pages":[{"title":"v26.2","href":"/docs/v26.2/troubleshoot-query-plan-regressions"}]},{"version":"v26.1","tabs":[{"tab":"Docs","icon":"book-open","pages":[{"title":"Docs","href":"/docs/v26.1"}]},{"tab":"Migrate","icon":"arrow-right-arrow-left","pages":[{"title":"Migrate","href":"/docs/molt/migration-overview"}]},{"tab":"SQL","icon":"code","pages":[{"title":"SQL","href":"/docs/v26.1/sql-statements"}]},{"tab":"Reference","icon":"book","pages":[{"title":"Reference","href":"/docs/v26.1/architecture/glossary"}]},{"tab":"Cluster API","icon":"rocket","pages":[{"title":"Cluster API","href":"/docs/api/cluster"}]},{"tab":"Troubleshoot","icon":"bug","groups":[{"group":"Troubleshooting","pages":[{"title":"Troubleshooting Overview","sidebarTitle":"Overview","href":"/docs/v26.1/troubleshooting-overview"},{"title":"Common Errors and Solutions","href":"/docs/v26.1/common-errors"},{"title":"Troubleshoot Self-Hosted Setup","href":"/docs/v26.1/cluster-setup-troubleshooting"},{"title":"Troubleshoot SQL Statements","href":"/docs/v26.1/query-behavior-troubleshooting"},{"title":"Transaction Retry Error Reference","href":"/docs/v26.1/transaction-retry-error-reference"},{"title":"Transaction Retry Error Example","href":"/docs/v26.1/transaction-retry-error-example"},{"title":"Differences in Metrics between Third-Party Monitoring Integrations and DB Console","href":"/docs/v26.1/differences-in-metrics-between-third-party-monitoring-integrations-and-db-console"},{"title":"Understand Hotspots","href":"/docs/v26.1/understand-hotspots"},{"title":"Detect Hotspots","description":null,"href":"/docs/v26.1/detect-hotspots"},{"title":"Troubleshoot Query Plan Regressions","href":"/docs/v26.1/troubleshoot-query-plan-regressions"},{"title":"Troubleshoot Replication Zones","description":null,"href":"/docs/v26.1/troubleshoot-replication-zones"},{"title":"Support Resources","href":"/docs/v26.1/support-resources"},{"title":"Automatic CPU Profiler","href":"/docs/v26.1/automatic-cpu-profiler"},{"title":"Automatic Go Execution Tracer","href":"/docs/v26.1/automatic-go-execution-tracer"},{"title":"Transaction Diagnostics","href":"/docs/v26.1/transaction-diagnostics"}]}]}]},{"version":"v25.4","tag":"LTS","pages":[{"title":"v25.4","href":"/docs/v25.4/troubleshoot-query-plan-regressions"}]},{"version":"v25.3","tag":"Unsupported","pages":[{"title":"v25.3","href":"/docs/v25.3/troubleshooting-overview"}]},{"version":"v25.2","tag":"LTS","pages":[{"title":"v25.2","href":"/docs/v25.2/troubleshooting-overview"}]},{"version":"v25.1","tag":"Unsupported","pages":[{"title":"v25.1","href":"/docs/v25.1/troubleshooting-overview"}]},{"version":"v24.3","tag":"LTS","pages":[{"title":"v24.3","href":"/docs/v24.3/troubleshooting-overview"}]},{"version":"v24.1","tag":"LTS","pages":[{"title":"v24.1","href":"/docs/v24.1/troubleshooting-overview"}]},{"version":"v23.2","tag":"LTS","pages":[{"title":"v23.2","href":"/docs/v23.2/troubleshooting-overview"}]},{"version":"v23.1","tag":"Unsupported","pages":[{"title":"v23.1","href":"/docs/v23.1/troubleshooting-overview"}]}]},{"product":"Cloud Deployments","icon":"cloud","description":"Fully managed CockroachDB","pages":[{"title":"Cloud Deployments","href":"/docs/cockroachcloud"}]},{"product":"Releases","icon":"list","description":"Version history, support policy \u0026 advisories","pages":[{"title":"Releases","href":"/docs/releases"}]}]},"basePath":"","title":"Troubleshoot Query Plan Regressions - CockroachDB","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DTFzvaXJ.js","lightbox-handle-r17bVUz3.js"]}