Type:
New Feature
Priority:
Major
Resolution:
Unresolved
Affects Version/s:
None
Fix Version/s:
None
Component/s:
None
Joins are very heavy algorithms, both in computation and/or in memory use. They need to hold a substantial amount of data in memory and perform hashing and other operations on that data. Joins can overflow memory limits and keeping balance between memory use and performance is tricky. Thus we have to filter information thaat is going into joins as much as possible. Columnstore already does great work in that regard, pushing WHERE filters before joins. This particular task is also concerned with that, adding Bloom filters' operations that approximate JOIN results and perform a secondary read to feed into joins data that is highly likely will be used in a join.
I did an experiment on query 96 from TPC-DS.
The query:
select top 100 count (*)
from store_sales
,household_demographics
,time_dim, store
where ss_sold_time_sk = time_dim.t_time_sk
and ss_hdemo_sk = household_demographics.hd_demo_sk
and ss_store_sk = s_store_sk
and time_dim.t_hour = 8
and time_dim.t_minute >= 30
and household_demographics.hd_dep_count = 5
and store.s_store_name = 'ese'
order by count (*)
;
The idea is to perform a double scan.
First, read of all columns needed, filter the data by constant filters and compute compatible Bllom filters (equal parameters - expected number of elements number of hashes and filter size) for columns that will be used in JOIN. As one example, we have join on ss_sold_time_sk = time_dim.t_time_sk ,, so for column ss_sold_time_sk we compute a Bloom filter that is compatible with the time_dim.t_time_sk . The same is done for two other join equalities, ,but parameters of filters can be different.
Then, after these filters are computed, we compute their JOIN approximation, by performing an intersection operation (bitwise AND) on Bloom filters for ss_sold_time_sk and time_dim.t_time_sk . This JOIN approximation filter will not pass through information that will most probably not result in a match (we can control for false positives).
Then, we perform a second read and filtering of the same columns, now we add a predicate "is in JOIN approximation" into the list of predicates. The result of this second scan goes into actual JOIN algorithm, but amount of data is expected to be significantly less voluminous.
This trick, performed on the 1G TPC-DS query 96 data shows that from 2.88 millon rows in stores_sales table only 949 rows pass all filters with join approximations (there are three, joined by AND), or 0.033%. As store_sales table does not have any WHERE clause filters that are not joins, all rows has to be read in our current implementation.
The comments contain plan discussion and linked tasks will constitute the plan. The approach is to write as less code as possible, reusing what we have already.
No workflow transitions have been executed yet.
{"report":{"fcp":843.6999998092651,"ttfb":196.19999980926514,"pageVisibility":"visible","entityId":129329,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"41852261-0e94-4190-914f-ef1b67cf1e3b","navigationType":0,"readyForUser":901.5,"redirectCount":0,"resourceLoadedEnd":895.1999998092651,"resourceLoadedStart":201.90000009536743,"resourceTiming":[{"duration":180.19999980926514,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":201.90000009536743,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":201.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":382.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":180.2000002861023,"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":202.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":202.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":382.40000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":188.7999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":202.30000019073486,"connectEnd":202.30000019073486,"connectStart":202.30000019073486,"domainLookupEnd":202.30000019073486,"domainLookupStart":202.30000019073486,"fetchStart":202.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":202.30000019073486,"responseEnd":391.09999990463257,"responseStart":391.09999990463257,"secureConnectionStart":202.30000019073486},{"duration":250.59999990463257,"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":202.59999990463257,"connectEnd":202.59999990463257,"connectStart":202.59999990463257,"domainLookupEnd":202.59999990463257,"domainLookupStart":202.59999990463257,"fetchStart":202.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":202.59999990463257,"responseEnd":453.19999980926514,"responseStart":453.19999980926514,"secureConnectionStart":202.59999990463257},{"duration":254.5,"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":202.69999980926514,"connectEnd":202.69999980926514,"connectStart":202.69999980926514,"domainLookupEnd":202.69999980926514,"domainLookupStart":202.69999980926514,"fetchStart":202.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":202.69999980926514,"responseEnd":457.19999980926514,"responseStart":457.19999980926514,"secureConnectionStart":202.69999980926514},{"duration":254.90000009536743,"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":202.90000009536743,"connectEnd":202.90000009536743,"connectStart":202.90000009536743,"domainLookupEnd":202.90000009536743,"domainLookupStart":202.90000009536743,"fetchStart":202.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":202.90000009536743,"responseEnd":457.80000019073486,"responseStart":457.80000019073486,"secureConnectionStart":202.90000009536743},{"duration":255.09999990463257,"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":203.09999990463257,"connectEnd":203.09999990463257,"connectStart":203.09999990463257,"domainLookupEnd":203.09999990463257,"domainLookupStart":203.09999990463257,"fetchStart":203.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":203.09999990463257,"responseEnd":458.19999980926514,"responseStart":458.19999980926514,"secureConnectionStart":203.09999990463257},{"duration":328.7999997138977,"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":203.30000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":203.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":532.0999999046326,"responseStart":0,"secureConnectionStart":0},{"duration":255.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":203.5,"connectEnd":203.5,"connectStart":203.5,"domainLookupEnd":203.5,"domainLookupStart":203.5,"fetchStart":203.5,"redirectEnd":0,"redirectStart":0,"requestStart":203.5,"responseEnd":458.69999980926514,"responseStart":458.69999980926514,"secureConnectionStart":203.5},{"duration":328.59999990463257,"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":203.59999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":203.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":532.1999998092651,"responseStart":0,"secureConnectionStart":0},{"duration":255.59999990463257,"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":203.80000019073486,"connectEnd":203.80000019073486,"connectStart":203.80000019073486,"domainLookupEnd":203.80000019073486,"domainLookupStart":203.80000019073486,"fetchStart":203.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":203.80000019073486,"responseEnd":459.40000009536743,"responseStart":459.40000009536743,"secureConnectionStart":203.80000019073486},{"duration":688,"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":204.5,"connectEnd":204.5,"connectStart":204.5,"domainLookupEnd":204.5,"domainLookupStart":204.5,"fetchStart":204.5,"redirectEnd":0,"redirectStart":0,"requestStart":204.5,"responseEnd":892.5,"responseStart":892.5,"secureConnectionStart":204.5},{"duration":690.5999999046326,"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":204.59999990463257,"connectEnd":204.59999990463257,"connectStart":204.59999990463257,"domainLookupEnd":204.59999990463257,"domainLookupStart":204.59999990463257,"fetchStart":204.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":204.59999990463257,"responseEnd":895.1999998092651,"responseStart":895.1999998092651,"secureConnectionStart":204.59999990463257},{"duration":349.30000019073486,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":543.5,"connectEnd":543.5,"connectStart":543.5,"domainLookupEnd":543.5,"domainLookupStart":543.5,"fetchStart":543.5,"redirectEnd":0,"redirectStart":0,"requestStart":543.5,"responseEnd":892.8000001907349,"responseStart":892.8000001907349,"secureConnectionStart":543.5},{"duration":113.59999990463257,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":831,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":831,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":944.5999999046326,"responseStart":0,"secureConnectionStart":0}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":42,"responseStart":196,"responseEnd":200,"domLoading":200,"domInteractive":1017,"domContentLoadedEventStart":1017,"domContentLoadedEventEnd":1058,"domComplete":1415,"loadEventStart":1415,"loadEventEnd":1416,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1001.5},{"name":"bigPipe.sidebar-id.end","time":1003.0999999046326},{"name":"bigPipe.activity-panel-pipe-id.start","time":1003.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1003.9000000953674},{"name":"activityTabFullyLoaded","time":1068.0999999046326}],"measures":[],"correlationId":"b902cd756576d1","effectiveType":"4g","downlink":10,"rtt":0,"serverDuration":90,"dbReadsTimeInMs":12,"dbConnsTimeInMs":19,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}