Type:
Task
Priority:
Major
Resolution:
Unresolved
Fix Version/s:
None
Histogram collection has been augmented in 10.4 with the ability to collect a percentage of rows. This was implemented via Bernoulli sampling. The drawback is that one has to perform a full table scan to perform sampling. This technique has reduced the bottleneck of Histograms collection substantially, however it can still be improved.
Storage engine API should be extended to allow the server to make use (if available) storage engine sampling capabilities.
This feature can be additionally used to support fast approximation functions such as a version of fast count-distinct with an estimator attached. (ex: Smoothed Jackknife Estimator) Additionally, with native sampling support, one could afford to perform various optimizations in the background (such as statistics collection), as the performance impact would be much smaller. Another use case for native sampling is SELECT FROM <table-sample>
https://www.2ndquadrant.com/en/blog/tablesample-in-postgresql-9-5-2/
The implementation will be done for 2 different storage engines (Aria & Innodb). The algorithm will make use of a weighted index-dive (to counteract if index pages are unbalanced).
{"report":{"fcp":1554,"ttfb":346.89999985694885,"pageVisibility":"visible","entityId":76183,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"44cf5bc9-e0a9-4829-8c2c-d7999f585e51","navigationType":0,"readyForUser":1649.8999998569489,"redirectCount":0,"resourceLoadedEnd":1756.8999998569489,"resourceLoadedStart":354.39999985694885,"resourceTiming":[{"duration":556.4000000953674,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":354.39999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":354.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":910.7999999523163,"responseStart":0,"secureConnectionStart":0},{"duration":556.5,"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":354.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":354.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":911.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":579.9000000953674,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":354.89999985694885,"connectEnd":354.89999985694885,"connectStart":354.89999985694885,"domainLookupEnd":354.89999985694885,"domainLookupStart":354.89999985694885,"fetchStart":354.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":354.89999985694885,"responseEnd":934.7999999523163,"responseStart":934.7999999523163,"secureConnectionStart":354.89999985694885},{"duration":847.0999999046326,"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":355.09999990463257,"connectEnd":355.09999990463257,"connectStart":355.09999990463257,"domainLookupEnd":355.09999990463257,"domainLookupStart":355.09999990463257,"fetchStart":355.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":355.09999990463257,"responseEnd":1202.1999998092651,"responseStart":1202.1999998092651,"secureConnectionStart":355.09999990463257},{"duration":851.7000000476837,"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":355.39999985694885,"connectEnd":355.39999985694885,"connectStart":355.39999985694885,"domainLookupEnd":355.39999985694885,"domainLookupStart":355.39999985694885,"fetchStart":355.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":355.39999985694885,"responseEnd":1207.0999999046326,"responseStart":1207.0999999046326,"secureConnectionStart":355.39999985694885},{"duration":852.0999999046326,"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":355.59999990463257,"connectEnd":355.59999990463257,"connectStart":355.59999990463257,"domainLookupEnd":355.59999990463257,"domainLookupStart":355.59999990463257,"fetchStart":355.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":355.59999990463257,"responseEnd":1207.6999998092651,"responseStart":1207.5999999046326,"secureConnectionStart":355.59999990463257},{"duration":852.3000001907349,"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":355.69999980926514,"connectEnd":355.69999980926514,"connectStart":355.69999980926514,"domainLookupEnd":355.69999980926514,"domainLookupStart":355.69999980926514,"fetchStart":355.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":355.69999980926514,"responseEnd":1208,"responseStart":1208,"secureConnectionStart":355.69999980926514},{"duration":853.6000001430511,"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":355.89999985694885,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":355.89999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1209.5,"responseStart":0,"secureConnectionStart":0},{"duration":852.5999999046326,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":356.09999990463257,"connectEnd":356.09999990463257,"connectStart":356.09999990463257,"domainLookupEnd":356.09999990463257,"domainLookupStart":356.09999990463257,"fetchStart":356.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":356.09999990463257,"responseEnd":1208.6999998092651,"responseStart":1208.6999998092651,"secureConnectionStart":356.09999990463257},{"duration":853.2999999523163,"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":356.2999999523163,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":356.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1209.5999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":853.2999999523163,"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":356.39999985694885,"connectEnd":356.39999985694885,"connectStart":356.39999985694885,"domainLookupEnd":356.39999985694885,"domainLookupStart":356.39999985694885,"fetchStart":356.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":356.39999985694885,"responseEnd":1209.6999998092651,"responseStart":1209.6999998092651,"secureConnectionStart":356.39999985694885},{"duration":1175.2000000476837,"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":357.39999985694885,"connectEnd":357.39999985694885,"connectStart":357.39999985694885,"domainLookupEnd":357.39999985694885,"domainLookupStart":357.39999985694885,"fetchStart":357.39999985694885,"redirectEnd":0,"redirectStart":0,"requestStart":357.39999985694885,"responseEnd":1532.5999999046326,"responseStart":1532.5999999046326,"secureConnectionStart":357.39999985694885},{"duration":1306.1999998092651,"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":357.5,"connectEnd":357.5,"connectStart":357.5,"domainLookupEnd":357.5,"domainLookupStart":357.5,"fetchStart":357.5,"redirectEnd":0,"redirectStart":0,"requestStart":357.5,"responseEnd":1663.6999998092651,"responseStart":1663.6999998092651,"secureConnectionStart":357.5},{"duration":438.59999990463257,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":1093.2999999523163,"connectEnd":1093.2999999523163,"connectStart":1093.2999999523163,"domainLookupEnd":1093.2999999523163,"domainLookupStart":1093.2999999523163,"fetchStart":1093.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":1093.2999999523163,"responseEnd":1531.8999998569489,"responseStart":1531.8999998569489,"secureConnectionStart":1093.2999999523163},{"duration":248.29999995231628,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1546.3999998569489,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1546.3999998569489,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1794.6999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":187.59999990463257,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-project.issue.navigator,-jira.view.issue,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true&whisper-enabled=true","startTime":1569.2999999523163,"connectEnd":1569.2999999523163,"connectStart":1569.2999999523163,"domainLookupEnd":1569.2999999523163,"domainLookupStart":1569.2999999523163,"fetchStart":1569.2999999523163,"redirectEnd":0,"redirectStart":0,"requestStart":1569.2999999523163,"responseEnd":1756.8999998569489,"responseStart":1756.8999998569489,"secureConnectionStart":1569.2999999523163}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":209,"responseStart":347,"responseEnd":352,"domLoading":352,"domInteractive":1824,"domContentLoadedEventStart":1824,"domContentLoadedEventEnd":1882,"domComplete":2352,"loadEventStart":2352,"loadEventEnd":2352,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1797.3999998569489},{"name":"bigPipe.sidebar-id.end","time":1798.6999998092651},{"name":"bigPipe.activity-panel-pipe-id.start","time":1798.8999998569489},{"name":"bigPipe.activity-panel-pipe-id.end","time":1799.8999998569489},{"name":"activityTabFullyLoaded","time":1894.5}],"measures":[],"correlationId":"11b1685f831e20","effectiveType":"4g","downlink":9.8,"rtt":0,"serverDuration":85,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
See MDEV-28637 for a patch that allows to test the sampling.