Type:
Task
Priority:
Major
Resolution:
Fixed
Under terms of this task we'll do two things:
Join classes select_handler and Pushdown_select into a single class
The current implementation with two parallel classes (select_handler and Pushdown_select) is hard to follow. Non of them can work without the other. The two-step construction stage looks too complex:
select_lex->select_h= select_lex->find_select_handler(thd);
if (select_lex->select_h)
{
/* Create a Pushdown_select object for later execution of the query */
if (!(select_lex->pushdown_select=
new (thd->mem_root) Pushdown_select(select_lex,
select_lex->select_h)))
{
delete select_lex->select_h;
select_lex->select_h= NULL;
DBUG_RETURN(TRUE);
}
}
With a single object it will be as simple as:
select_lex->pushdown_select= select_lex->find_select_handler(thd);
The destruction stage looks dangerous in the current implementation:
Pushdown_select::~Pushdown_select()
{
if (handler->table)
free_tmp_table(handler->thd, handler->table);
delete handler;
select->select_h= NULL;
}
So the server deletes a Pushdown_select instance, which then deletes the select_handler. It's much safer just to delete a single object.
Make it possible for the engine (e.g. XPand) to create a TABLE on its own and then reuse it during select_handler() creation time by assigning to select_handler::table. This is needed to avoid two executions of create_tmp_table() which currenly happen with XPand. So during the preparation stage, the TABLE will already be assigned to select_handler::table and select_handler will not need to make it again during the preparation stage. The method will looks about like this:
bool select_handler::prepare()
{
/*
Some engines (e.g. XPand) initialize "table" on their own.
So we need to create a temporary table only if "table" is NULL.
*/
if (!table && !(table= create_tmp_table(thd, select)))
DBUG_RETURN( true );
DBUG_RETURN(table->fill_item_list(&result_columns));
}
Notice, in the new reduction, the table is created only if select_handler::table is NULL.
blocks
MDEV-23803
Fix pushdown select not to use TABLE and Field
Open
{"report":{"fcp":1093.3000001907349,"ttfb":182.59999990463257,"pageVisibility":"visible","entityId":92129,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"da2db998-765d-406e-84fd-b5955b59a48c","navigationType":0,"readyForUser":1179.3000001907349,"redirectCount":0,"resourceLoadedEnd":1282.9000000953674,"resourceLoadedStart":194.7000002861023,"resourceTiming":[{"duration":312.8999996185303,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":194.7000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":194.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":507.59999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":312.90000009536743,"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":195,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":195,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":507.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":321.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":195.2000002861023,"connectEnd":195.2000002861023,"connectStart":195.2000002861023,"domainLookupEnd":195.2000002861023,"domainLookupStart":195.2000002861023,"fetchStart":195.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":195.2000002861023,"responseEnd":517,"responseStart":517,"secureConnectionStart":195.2000002861023},{"duration":426.19999980926514,"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":195.40000009536743,"connectEnd":195.40000009536743,"connectStart":195.40000009536743,"domainLookupEnd":195.40000009536743,"domainLookupStart":195.40000009536743,"fetchStart":195.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":195.40000009536743,"responseEnd":621.5999999046326,"responseStart":621.5999999046326,"secureConnectionStart":195.40000009536743},{"duration":432.6000003814697,"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":195.59999990463257,"connectEnd":195.59999990463257,"connectStart":195.59999990463257,"domainLookupEnd":195.59999990463257,"domainLookupStart":195.59999990463257,"fetchStart":195.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":195.59999990463257,"responseEnd":628.2000002861023,"responseStart":628.2000002861023,"secureConnectionStart":195.59999990463257},{"duration":432.7999997138977,"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":195.80000019073486,"connectEnd":195.80000019073486,"connectStart":195.80000019073486,"domainLookupEnd":195.80000019073486,"domainLookupStart":195.80000019073486,"fetchStart":195.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":195.80000019073486,"responseEnd":628.5999999046326,"responseStart":628.5999999046326,"secureConnectionStart":195.80000019073486},{"duration":433,"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":196,"connectEnd":196,"connectStart":196,"domainLookupEnd":196,"domainLookupStart":196,"fetchStart":196,"redirectEnd":0,"redirectStart":0,"requestStart":196,"responseEnd":629,"responseStart":629,"secureConnectionStart":196},{"duration":469.09999990463257,"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":196.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":196.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":665.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":433.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":196.30000019073486,"connectEnd":196.30000019073486,"connectStart":196.30000019073486,"domainLookupEnd":196.30000019073486,"domainLookupStart":196.30000019073486,"fetchStart":196.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":196.30000019073486,"responseEnd":629.5999999046326,"responseStart":629.5999999046326,"secureConnectionStart":196.30000019073486},{"duration":469,"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":196.40000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":196.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":665.4000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":433.6000003814697,"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":196.59999990463257,"connectEnd":196.59999990463257,"connectStart":196.59999990463257,"domainLookupEnd":196.59999990463257,"domainLookupStart":196.59999990463257,"fetchStart":196.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":196.59999990463257,"responseEnd":630.2000002861023,"responseStart":630.2000002861023,"secureConnectionStart":196.59999990463257},{"duration":718.8000001907349,"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":197.5,"connectEnd":197.5,"connectStart":197.5,"domainLookupEnd":197.5,"domainLookupStart":197.5,"fetchStart":197.5,"redirectEnd":0,"redirectStart":0,"requestStart":197.5,"responseEnd":916.3000001907349,"responseStart":916.3000001907349,"secureConnectionStart":197.5},{"duration":1084.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":197.5,"connectEnd":197.5,"connectStart":197.5,"domainLookupEnd":197.5,"domainLookupStart":197.5,"fetchStart":197.5,"redirectEnd":0,"redirectStart":0,"requestStart":197.5,"responseEnd":1282,"responseStart":1282,"secureConnectionStart":197.5},{"duration":237.10000038146973,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":679.5999999046326,"connectEnd":679.5999999046326,"connectStart":679.5999999046326,"domainLookupEnd":679.5999999046326,"domainLookupStart":679.5999999046326,"fetchStart":679.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":679.5999999046326,"responseEnd":916.7000002861023,"responseStart":916.7000002861023,"secureConnectionStart":679.5999999046326},{"duration":299.09999990463257,"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":983.8000001907349,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":983.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1282.9000000953674,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":18,"responseStart":182,"responseEnd":192,"domLoading":192,"domInteractive":1302,"domContentLoadedEventStart":1302,"domContentLoadedEventEnd":1341,"domComplete":3004,"loadEventStart":3004,"loadEventEnd":3006,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1285.7000002861023},{"name":"bigPipe.sidebar-id.end","time":1286.5999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1286.7000002861023},{"name":"bigPipe.activity-panel-pipe-id.end","time":1289.0999999046326},{"name":"activityTabFullyLoaded","time":1348.0999999046326}],"measures":[],"correlationId":"fc7956d02de6f6","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":102,"dbReadsTimeInMs":9,"dbConnsTimeInMs":17,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}