Type:
Task
Priority:
Minor
Resolution:
Duplicate
Fix Version/s:
None
Component/s:
None
Hi guys,
i was trying to work around MDEV-4414 with virtual column + index
but, check my problem... here the table definition:
create table t (
linha_digitavel varchar (54) not null default '' ,
tmp_substr char (37) as ( SUBSTRING (linha_digitavel,1,37)) persistent,
key linha_key (linha_digitavel),
key tmp_substr_key (tmp_substr)
);
now the problem... i have about 50k rows in this table..
explain select * from t where tmp_substr= 'abc'
result => using index condition, key = 'tmp_substr_key', 1 rows
explain select * from t where SUBSTRING (linha_digitavel,1,37)= 'abc'
result => using where, full table scan
—
well i see two kinds of optimization here...
1)the MDEV-4414 , where substring(?,1,?) could use index "key linha_key (linha_digitavel)"
2)the "SUBSTRING(linha_digitavel,1,37)" could be rewrite as "tmp_substr"
(2) is the MDEV feature requested here
it give DBA an oportunity to optimize closed systems, that we can't change source code, just tables...
think about a sloowww query that could be optimized with a virtual column + index + sql rewrite ! ok many job... but it's a nice feature
think about determinist functions (md5 for example) that could be optimized just replacing the "determinist_function(some_parameters)" to the virtual column, and the option to index it and make it really faster!
think about MongoDB like features... a schema less table with index on fields that may or may not exists based on LONGBLOB fields + Dynamic Column + Virtual Index, i could say goodbye mongoDB for small systems (ok the map reduce is a parallel operation with high query performace, but it's not mysql =] )
is blocked by
MDEV-6017
Add support for Indexes on Expressions
Stalled
{"report":{"fcp":2100.199999809265,"ttfb":576.8000001907349,"pageVisibility":"visible","entityId":23922,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":32,"apdex":0.5,"journeyId":"16e39b28-2c11-4ad6-a946-fa5e716d0e06","navigationType":0,"readyForUser":2186.800000190735,"redirectCount":0,"resourceLoadedEnd":3229.5,"resourceLoadedStart":583.1999998092651,"resourceTiming":[{"duration":588.1000003814697,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":583.1999998092651,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":583.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1171.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":600.5999999046326,"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":583.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":583.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1184.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":700.2000002861023,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":583.6999998092651,"connectEnd":583.6999998092651,"connectStart":583.6999998092651,"domainLookupEnd":583.6999998092651,"domainLookupStart":583.6999998092651,"fetchStart":583.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":583.6999998092651,"responseEnd":1283.9000000953674,"responseStart":1283.9000000953674,"secureConnectionStart":583.6999998092651},{"duration":870.2999997138977,"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":583.9000000953674,"connectEnd":583.9000000953674,"connectStart":583.9000000953674,"domainLookupEnd":583.9000000953674,"domainLookupStart":583.9000000953674,"fetchStart":583.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":583.9000000953674,"responseEnd":1454.1999998092651,"responseStart":1454.1999998092651,"secureConnectionStart":583.9000000953674},{"duration":876.3000001907349,"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":584.0999999046326,"connectEnd":584.0999999046326,"connectStart":584.0999999046326,"domainLookupEnd":584.0999999046326,"domainLookupStart":584.0999999046326,"fetchStart":584.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":584.0999999046326,"responseEnd":1460.4000000953674,"responseStart":1460.4000000953674,"secureConnectionStart":584.0999999046326},{"duration":876.8000001907349,"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":584.1999998092651,"connectEnd":584.1999998092651,"connectStart":584.1999998092651,"domainLookupEnd":584.1999998092651,"domainLookupStart":584.1999998092651,"fetchStart":584.1999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":584.1999998092651,"responseEnd":1461,"responseStart":1461,"secureConnectionStart":584.1999998092651},{"duration":877.0999999046326,"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":584.3000001907349,"connectEnd":584.3000001907349,"connectStart":584.3000001907349,"domainLookupEnd":584.3000001907349,"domainLookupStart":584.3000001907349,"fetchStart":584.3000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":584.3000001907349,"responseEnd":1461.4000000953674,"responseStart":1461.4000000953674,"secureConnectionStart":584.3000001907349},{"duration":1023.5999999046326,"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":584.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":584.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1608.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":877.3000001907349,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":584.6999998092651,"connectEnd":584.6999998092651,"connectStart":584.6999998092651,"domainLookupEnd":584.6999998092651,"domainLookupStart":584.6999998092651,"fetchStart":584.6999998092651,"redirectEnd":0,"redirectStart":0,"requestStart":584.6999998092651,"responseEnd":1462,"responseStart":1462,"secureConnectionStart":584.6999998092651},{"duration":1004.7000002861023,"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":603.5999999046326,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":603.5999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1608.3000001907349,"responseStart":0,"secureConnectionStart":0},{"duration":858.9000000953674,"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":603.9000000953674,"connectEnd":603.9000000953674,"connectStart":603.9000000953674,"domainLookupEnd":603.9000000953674,"domainLookupStart":603.9000000953674,"fetchStart":603.9000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":603.9000000953674,"responseEnd":1462.8000001907349,"responseStart":1462.8000001907349,"secureConnectionStart":603.9000000953674},{"duration":2621.2000002861023,"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":605.0999999046326,"connectEnd":605.0999999046326,"connectStart":605.0999999046326,"domainLookupEnd":605.0999999046326,"domainLookupStart":605.0999999046326,"fetchStart":605.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":605.0999999046326,"responseEnd":3226.300000190735,"responseStart":3226.300000190735,"secureConnectionStart":605.0999999046326},{"duration":2624.4000000953674,"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":605.0999999046326,"connectEnd":605.0999999046326,"connectStart":605.0999999046326,"domainLookupEnd":605.0999999046326,"domainLookupStart":605.0999999046326,"fetchStart":605.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":605.0999999046326,"responseEnd":3229.5,"responseStart":3229.5,"secureConnectionStart":605.0999999046326},{"duration":1251,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1654.0999999046326,"connectEnd":1654.0999999046326,"connectStart":1654.0999999046326,"domainLookupEnd":1654.0999999046326,"domainLookupStart":1654.0999999046326,"fetchStart":1654.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":1654.0999999046326,"responseEnd":2905.0999999046326,"responseStart":2905.0999999046326,"secureConnectionStart":1654.0999999046326},{"duration":1176.9000000953674,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":2091.4000000953674,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":2091.4000000953674,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":3268.300000190735,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":426,"responseStart":576,"responseEnd":599,"domLoading":581,"domInteractive":3270,"domContentLoadedEventStart":3270,"domContentLoadedEventEnd":3355,"domComplete":4763,"loadEventStart":4763,"loadEventEnd":4765,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":3232.9000000953674},{"name":"bigPipe.sidebar-id.end","time":3233.800000190735},{"name":"bigPipe.activity-panel-pipe-id.start","time":3234},{"name":"bigPipe.activity-panel-pipe-id.end","time":3239},{"name":"activityTabFullyLoaded","time":3367.199999809265}],"measures":[],"correlationId":"47a5e402b1c928","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":89,"dbReadsTimeInMs":7,"dbConnsTimeInMs":16,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}