In the current implementation, when a recursive CTE reaches max_recursive_iterations, it just stops execution and returns a result set without an error or a warning. It wasn't a very big problem initially, as the default for max_recursive_iterations was 18446744073709551615, so it wouldn't be reachable anyway, and those who changed it presumingly would know what they are doing.
But then there was a patch in 10.6.0 which changed the default of max_recursive_iterations from the old 18446744073709551615 to 1000.
1000 is a very low value, it can be reached easily in many practical use cases. For example, this simple CTE
createtable t aswith recursive cte as (select 1 as a unionselect a + 1 as a from cte where a < 10000 ) select * from cte;
is obviously meant to create a table with 10000 values, but instead it now silently creates 1001 and succeeds afterwards.
This change could have caused any number of hidden regressions in user applications, as it's very difficult to notice.
I'm not sure what is the best way to fix it, given that it has already been in GA for a long time. Throwing an error upon reaching max_recursive_iterations is an obvious option, consistent with usual server logic, but it's a fairly big change in behavior, I don't know if it's allowed for post-GA releases.
Another option is increasing the default to a really big value.
A warning would be a reasonable behavior, we already do it in similar cases:
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least ### rows, which exceeds LIMIT ROWS EXAMINED (1000). The query result may be incomplete
Sergei Golubchik
added a comment - A warning would be a reasonable behavior, we already do it in similar cases:
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least ### rows, which exceeds LIMIT ROWS EXAMINED (1000). The query result may be incomplete
People
Sergei Golubchik
Elena Stepanova
Votes:
0Vote for this issue
Watchers:
2Start watching this issue
Dates
Created:
Updated:
Resolved:
Git Integration
Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.
{"report":{"fcp":985,"ttfb":242.69999980926514,"pageVisibility":"visible","entityId":121697,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"948a0ee3-d61a-43b8-b2b4-48ab398d78f0","navigationType":0,"readyForUser":1066.0999994277954,"redirectCount":0,"resourceLoadedEnd":1092.1999998092651,"resourceLoadedStart":248.5999994277954,"resourceTiming":[{"duration":193.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":248.5999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":248.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":442.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":193.9000005722046,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":248.79999923706055,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":248.79999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":442.69999980926514,"responseStart":0,"secureConnectionStart":0},{"duration":207.0999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":249,"connectEnd":249,"connectStart":249,"domainLookupEnd":249,"domainLookupStart":249,"fetchStart":249,"redirectEnd":0,"redirectStart":0,"requestStart":249,"responseEnd":456.0999994277954,"responseStart":456.0999994277954,"secureConnectionStart":249},{"duration":309.0999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/494e4c556ecbb29f90a3d3b4f09cb99c/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true&whisper-enabled=true","startTime":249.19999980926514,"connectEnd":249.19999980926514,"connectStart":249.19999980926514,"domainLookupEnd":249.19999980926514,"domainLookupStart":249.19999980926514,"fetchStart":249.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":249.19999980926514,"responseEnd":558.2999992370605,"responseStart":558.2999992370605,"secureConnectionStart":249.19999980926514},{"duration":312.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":249.39999961853027,"connectEnd":249.39999961853027,"connectStart":249.39999961853027,"domainLookupEnd":249.39999961853027,"domainLookupStart":249.39999961853027,"fetchStart":249.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":249.39999961853027,"responseEnd":562.1999998092651,"responseStart":562.1999998092651,"secureConnectionStart":249.39999961853027},{"duration":313.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":249.5999994277954,"connectEnd":249.5999994277954,"connectStart":249.5999994277954,"domainLookupEnd":249.5999994277954,"domainLookupStart":249.5999994277954,"fetchStart":249.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":249.5999994277954,"responseEnd":562.6999998092651,"responseStart":562.6999998092651,"secureConnectionStart":249.5999994277954},{"duration":313.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":249.69999980926514,"connectEnd":249.69999980926514,"connectStart":249.69999980926514,"domainLookupEnd":249.69999980926514,"domainLookupStart":249.69999980926514,"fetchStart":249.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":249.69999980926514,"responseEnd":563.1999998092651,"responseStart":563.1999998092651,"secureConnectionStart":249.69999980926514},{"duration":352.3999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":249.89999961853027,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":249.89999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":602.2999992370605,"responseStart":0,"secureConnectionStart":0},{"duration":313.6000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":250.0999994277954,"connectEnd":250.0999994277954,"connectStart":250.0999994277954,"domainLookupEnd":250.0999994277954,"domainLookupStart":250.0999994277954,"fetchStart":250.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":250.0999994277954,"responseEnd":563.6999998092651,"responseStart":563.6999998092651,"secureConnectionStart":250.0999994277954},{"duration":352.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":250.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":250.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":602.3999996185303,"responseStart":0,"secureConnectionStart":0},{"duration":313.80000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":250.39999961853027,"connectEnd":250.39999961853027,"connectStart":250.39999961853027,"domainLookupEnd":250.39999961853027,"domainLookupStart":250.39999961853027,"fetchStart":250.39999961853027,"redirectEnd":0,"redirectStart":0,"requestStart":250.39999961853027,"responseEnd":564.1999998092651,"responseStart":564.1999998092651,"secureConnectionStart":250.39999961853027},{"duration":455.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":251.19999980926514,"connectEnd":251.19999980926514,"connectStart":251.19999980926514,"domainLookupEnd":251.19999980926514,"domainLookupStart":251.19999980926514,"fetchStart":251.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":251.19999980926514,"responseEnd":706.5999994277954,"responseStart":706.5999994277954,"secureConnectionStart":251.19999980926514},{"duration":789.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":251.29999923706055,"connectEnd":251.29999923706055,"connectStart":251.29999923706055,"domainLookupEnd":251.29999923706055,"domainLookupStart":251.29999923706055,"fetchStart":251.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":251.29999923706055,"responseEnd":1040.7999992370605,"responseStart":1040.7999992370605,"secureConnectionStart":251.29999923706055},{"duration":96.80000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":614.3999996185303,"connectEnd":614.3999996185303,"connectStart":614.3999996185303,"domainLookupEnd":614.3999996185303,"domainLookupStart":614.3999996185303,"fetchStart":614.3999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":614.3999996185303,"responseEnd":711.1999998092651,"responseStart":711.0999994277954,"secureConnectionStart":614.3999996185303},{"duration":201.9000005722046,"initiatorType":"link","name":"https://jira.mariadb.org/s/d5715adaadd168a9002b108b2b039b50-CDN/lu2cib/820016/12ta74/be4b45e9cec53099498fa61c8b7acba4/_/download/contextbatch/css/jira.project.sidebar,-_super,-project.issue.navigator,-jira.general,-jira.browse.project,-jira.view.issue,-jira.global,-atl.general,-com.atlassian.jira.projects.sidebar.init/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":890.2999992370605,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":890.2999992370605,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1092.1999998092651,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":65,"responseStart":242,"responseEnd":245,"domLoading":246,"domInteractive":1116,"domContentLoadedEventStart":1116,"domContentLoadedEventEnd":1155,"domComplete":1353,"loadEventStart":1353,"loadEventEnd":1354,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1104.1999998092651},{"name":"bigPipe.sidebar-id.end","time":1105},{"name":"bigPipe.activity-panel-pipe-id.start","time":1105.2999992370605},{"name":"bigPipe.activity-panel-pipe-id.end","time":1106.0999994277954},{"name":"activityTabFullyLoaded","time":1172.3999996185303}],"measures":[],"correlationId":"c9ef315bbc9ccb","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":108,"dbReadsTimeInMs":10,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
A warning would be a reasonable behavior, we already do it in similar cases:
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least ### rows, which exceeds LIMIT ROWS EXAMINED (1000). The query result may be incomplete