I have a table with a couple million rows in it:
CREATE TABLE `big_table` (
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`c1` char(32) DEFAULT NULL,
|
`c2` char(32) DEFAULT NULL,
|
`c3` char(32) DEFAULT NULL,
|
PRIMARY KEY (`id`)
|
) ENGINE=InnoDB;
|
Each row of the table has different values in the character columns, but all three character columns are the same for each row:
mysql 10.0.10-MariaDB (root) [test]> select * from big_table limit 10;
|
+---------+----------------------------------+----------------------------------+----------------------------------+
|
| id | c1 | c2 | c3 |
|
+---------+----------------------------------+----------------------------------+----------------------------------+
|
| 1960001 | a64f35b091f92301e81abd6c881efa4c | a64f35b091f92301e81abd6c881efa4c | a64f35b091f92301e81abd6c881efa4c |
|
| 1960002 | 3cddf70e775e566a270b3a80ebeb635f | 3cddf70e775e566a270b3a80ebeb635f | 3cddf70e775e566a270b3a80ebeb635f |
|
| 1960003 | f3f75c6448ae94cc20c78bcff17b0d92 | f3f75c6448ae94cc20c78bcff17b0d92 | f3f75c6448ae94cc20c78bcff17b0d92 |
|
| 1960004 | f0f39711ef82cb8f99443b59ad12f940 | f0f39711ef82cb8f99443b59ad12f940 | f0f39711ef82cb8f99443b59ad12f940 |
|
I tried creating a really simple pivot table:
create table big_table_pivot engine=connect table_type=pivot tabname=big_table;
Shortly after executing that create table statement, mysqld crashes:
#0 0x00007ffff6a907fe in __longjmp () from /lib64/libc.so.6
|
#1 0x4830f0d22fbc1ec0 in ?? ()
|
It crashes even after removing quite a lot of rows. Now with <200,000 rows in the table, the CREATE TABLE statement appears to be hanging, rather than crashing.
{"report":{"fcp":848.5999999046326,"ttfb":213.09999990463257,"pageVisibility":"visible","entityId":34305,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":1,"journeyId":"b17b1a8e-6820-47c0-b1e8-3c8fade46066","navigationType":0,"readyForUser":975.5,"redirectCount":0,"resourceLoadedEnd":1084,"resourceLoadedStart":229.5,"resourceTiming":[{"duration":28.200000286102295,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":229.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":229.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":257.7000002861023,"responseStart":0,"secureConnectionStart":0},{"duration":28.699999809265137,"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":229.80000019073486,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":229.80000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":258.5,"responseStart":0,"secureConnectionStart":0},{"duration":93.60000038146973,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":230.09999990463257,"connectEnd":230.09999990463257,"connectStart":230.09999990463257,"domainLookupEnd":230.09999990463257,"domainLookupStart":230.09999990463257,"fetchStart":230.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":230.09999990463257,"responseEnd":323.7000002861023,"responseStart":323.7000002861023,"secureConnectionStart":230.09999990463257},{"duration":253.90000009536743,"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":231.30000019073486,"connectEnd":231.30000019073486,"connectStart":231.30000019073486,"domainLookupEnd":231.30000019073486,"domainLookupStart":231.30000019073486,"fetchStart":231.30000019073486,"redirectEnd":0,"redirectStart":0,"requestStart":231.30000019073486,"responseEnd":485.2000002861023,"responseStart":485.09999990463257,"secureConnectionStart":231.30000019073486},{"duration":257.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":231.59999990463257,"connectEnd":231.59999990463257,"connectStart":231.59999990463257,"domainLookupEnd":231.59999990463257,"domainLookupStart":231.59999990463257,"fetchStart":231.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":231.59999990463257,"responseEnd":489.09999990463257,"responseStart":489.09999990463257,"secureConnectionStart":231.59999990463257},{"duration":257.8999996185303,"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":231.7000002861023,"connectEnd":231.7000002861023,"connectStart":231.7000002861023,"domainLookupEnd":231.7000002861023,"domainLookupStart":231.7000002861023,"fetchStart":231.7000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":231.7000002861023,"responseEnd":489.59999990463257,"responseStart":489.59999990463257,"secureConnectionStart":231.7000002861023},{"duration":258.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":231.90000009536743,"connectEnd":231.90000009536743,"connectStart":231.90000009536743,"domainLookupEnd":231.90000009536743,"domainLookupStart":231.90000009536743,"fetchStart":231.90000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":231.90000009536743,"responseEnd":490,"responseStart":490,"secureConnectionStart":231.90000009536743},{"duration":260.80000019073486,"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":232.09999990463257,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":232.09999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":492.90000009536743,"responseStart":0,"secureConnectionStart":0},{"duration":258.2999997138977,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":232.2000002861023,"connectEnd":232.2000002861023,"connectStart":232.2000002861023,"domainLookupEnd":232.2000002861023,"domainLookupStart":232.2000002861023,"fetchStart":232.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":232.2000002861023,"responseEnd":490.5,"responseStart":490.5,"secureConnectionStart":232.2000002861023},{"duration":260.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":232.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":232.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":493.09999990463257,"responseStart":0,"secureConnectionStart":0},{"duration":258.5,"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":232.59999990463257,"connectEnd":232.59999990463257,"connectStart":232.59999990463257,"domainLookupEnd":232.59999990463257,"domainLookupStart":232.59999990463257,"fetchStart":232.59999990463257,"redirectEnd":0,"redirectStart":0,"requestStart":232.59999990463257,"responseEnd":491.09999990463257,"responseStart":491.09999990463257,"secureConnectionStart":232.59999990463257},{"duration":643.5999999046326,"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":233.40000009536743,"connectEnd":233.40000009536743,"connectStart":233.40000009536743,"domainLookupEnd":233.40000009536743,"domainLookupStart":233.40000009536743,"fetchStart":233.40000009536743,"redirectEnd":0,"redirectStart":0,"requestStart":233.40000009536743,"responseEnd":877,"responseStart":877,"secureConnectionStart":233.40000009536743},{"duration":850.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":233.5,"connectEnd":233.5,"connectStart":233.5,"domainLookupEnd":233.5,"domainLookupStart":233.5,"fetchStart":233.5,"redirectEnd":0,"redirectStart":0,"requestStart":233.5,"responseEnd":1084,"responseStart":1084,"secureConnectionStart":233.5},{"duration":339.40000009536743,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":538.0999999046326,"connectEnd":538.0999999046326,"connectStart":538.0999999046326,"domainLookupEnd":538.0999999046326,"domainLookupStart":538.0999999046326,"fetchStart":538.0999999046326,"redirectEnd":0,"redirectStart":0,"requestStart":538.0999999046326,"responseEnd":877.5,"responseStart":877.5,"secureConnectionStart":538.0999999046326},{"duration":397.69999980926514,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":841.2000002861023,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":841.2000002861023,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1238.9000000953674,"responseStart":0,"secureConnectionStart":0},{"duration":283.5,"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":1095.8000001907349,"connectEnd":1095.8000001907349,"connectStart":1095.8000001907349,"domainLookupEnd":1095.8000001907349,"domainLookupStart":1095.8000001907349,"fetchStart":1095.8000001907349,"redirectEnd":0,"redirectStart":0,"requestStart":1095.8000001907349,"responseEnd":1379.3000001907349,"responseStart":1379.3000001907349,"secureConnectionStart":1095.8000001907349}],"fetchStart":0,"domainLookupStart":0,"domainLookupEnd":0,"connectStart":0,"connectEnd":0,"requestStart":61,"responseStart":213,"responseEnd":223,"domLoading":218,"domInteractive":1312,"domContentLoadedEventStart":1312,"domContentLoadedEventEnd":1369,"domComplete":1899,"loadEventStart":1899,"loadEventEnd":1900,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1256.8000001907349},{"name":"bigPipe.sidebar-id.end","time":1259},{"name":"bigPipe.activity-panel-pipe-id.start","time":1259.3000001907349},{"name":"bigPipe.activity-panel-pipe-id.end","time":1260.7000002861023},{"name":"activityTabFullyLoaded","time":1386.4000000953674}],"measures":[],"correlationId":"e37eab752fb35c","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":91,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
Well, PIVOT is probably not meant to be used on very big tables. It requires a lot of storage to find the distinct PIVOT column names and, if there are many, can produce tables with too many columns.
However, a bug caused exhausted memory to crash the server instead of raising an error condition with a proper message.
This was fixed and it should not crash anymore.
By the way, it is not hanging on big tables but just takes a very long time.